View | Details | Raw Unified | Return to issue 121975
Collapse All | Expand All

(-)source/dmapper/DomainMapperTableHandler.cxx (+1 lines)
Lines 26-31 Link Here
26
#include <com/sun/star/table/TableBorderDistances.hpp>
26
#include <com/sun/star/table/TableBorderDistances.hpp>
27
#include <com/sun/star/table/TableBorder.hpp>
27
#include <com/sun/star/table/TableBorder.hpp>
28
#include <com/sun/star/text/HoriOrientation.hpp>
28
#include <com/sun/star/text/HoriOrientation.hpp>
29
#include <com/sun/star/text/SizeType.hpp>
29
#include <dmapperLoggers.hxx>
30
#include <dmapperLoggers.hxx>
30
31
31
#ifdef DEBUG_DMAPPER_TABLE_HANDLER
32
#ifdef DEBUG_DMAPPER_TABLE_HANDLER
(-)source/dmapper/DomainMapperTableManager.cxx (-34 / +57 lines)
Lines 118-125 Link Here
118
                    else
118
                    else
119
                    {
119
                    {
120
                        m_nTableWidth = pMeasureHandler->getMeasureValue();
120
                        m_nTableWidth = pMeasureHandler->getMeasureValue();
121
                        if( m_nTableWidth )
121
						if( m_nTableWidth )
122
						{
123
							pPropMap->setValue( TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::FIX );
122
                            pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, m_nTableWidth );
124
                            pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, m_nTableWidth );
125
						}
126
						else if( pMeasureHandler->getUnit() == NS_ooxml::LN_Value_ST_TblWidth_pct )
127
						{
128
							sal_Int32 nPercent = pMeasureHandler->getValue() / 50;
129
							if(nPercent > 100)
130
								nPercent = 100;
131
							pPropMap->setValue( TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::VARIABLE );
132
							pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, nPercent );
133
						}
134
						else if( pMeasureHandler->getUnit() == NS_ooxml::LN_Value_ST_TblWidth_auto )
135
						{
136
							pPropMap->setValue( TablePropertyMap::TABLE_WIDTH_TYPE, text::SizeType::VARIABLE );
137
							pPropMap->setValue( TablePropertyMap::TABLE_WIDTH, 100 );
138
						}
123
                    }
139
                    }
124
#ifdef DEBUG_DOMAINMAPPER
140
#ifdef DEBUG_DOMAINMAPPER
125
                    dmapper_logger->addTag(pPropMap->toTag());
141
                    dmapper_logger->addTag(pPropMap->toTag());
Lines 422-465 Link Here
422
    for( ; aGridSpanIter != pCurrentSpans->end(); ++aGridSpanIter)
438
    for( ; aGridSpanIter != pCurrentSpans->end(); ++aGridSpanIter)
423
        nGrids += *aGridSpanIter;
439
        nGrids += *aGridSpanIter;
424
440
425
    if( pTableGrid->size() == nGrids )
441
	// sj: the grid is having no units... they is containing only relative values.
426
    {
442
	// a table with a grid of "1:2:1" looks identical as if the table is having
427
        //determine table width 
443
	// a grid of "20:40:20" and it doesn't have to do something with the tableWidth
428
        double nFullWidth = m_nTableWidth;
444
	// -> so we have get the sum of each grid entry for the fullWidthRelative:
429
        //the positions have to be distibuted in a range of 10000 
445
	int nFullWidthRelative = 0;
430
        const double nFullWidthRelative = 10000.;
446
	for (unsigned int i = 0 ; i < (*pTableGrid.get()).size(); i++ )
431
        uno::Sequence< text::TableColumnSeparator > aSeparators( m_nCell - 1 );
447
		nFullWidthRelative += (*pTableGrid.get())[ i ];
432
        text::TableColumnSeparator* pSeparators = aSeparators.getArray();
433
        sal_Int16 nLastRelPos = 0;
434
        sal_uInt32 nBorderGridIndex = 0;
435
448
436
        ::std::vector< sal_Int32 >::const_iterator aSpansIter = pCurrentSpans->begin( );
449
	if( m_nCell > 0 && nFullWidthRelative > 0 )
437
        for( sal_uInt32 nBorder = 0; nBorder < m_nCell - 1; ++nBorder )
450
	{
438
        {
451
		if( pTableGrid->size() == nGrids )
439
            sal_Int32 nGridCount = *aSpansIter;
452
		{
440
            double fGridWidth = 0.;
453
			uno::Sequence< text::TableColumnSeparator > aSeparators( m_nCell - 1 );
441
            do
454
			text::TableColumnSeparator* pSeparators = aSeparators.getArray();
442
            {
455
			sal_Int16 nLastRelPos = 0;
443
                fGridWidth += (*pTableGrid.get())[nBorderGridIndex++];
456
			sal_uInt32 nBorderGridIndex = 0;
444
            }while( --nGridCount );
445
            
446
            sal_Int16 nRelPos = 
447
                sal::static_int_cast< sal_Int16 >(fGridWidth * nFullWidthRelative / nFullWidth );
448
457
449
            pSeparators[nBorder].Position =  nRelPos + nLastRelPos;
458
			::std::vector< sal_Int32 >::const_iterator aSpansIter = pCurrentSpans->begin( );
450
            pSeparators[nBorder].IsVisible = sal_True;
459
			for( sal_uInt32 nBorder = 0; nBorder < m_nCell - 1; ++nBorder )
451
            nLastRelPos = nLastRelPos + nRelPos;
460
			{
452
            aSpansIter++;
461
				sal_Int32 nGridCount = *aSpansIter;
453
        }
462
				double fGridWidth = 0.;
454
        TablePropertyMapPtr pPropMap( new TablePropertyMap );
463
				do
455
        pPropMap->Insert( PROP_TABLE_COLUMN_SEPARATORS, false, uno::makeAny( aSeparators ) );
464
				{
465
					fGridWidth += (*pTableGrid.get())[nBorderGridIndex++];
466
				}while( --nGridCount );
467
468
				sal_Int16 nRelPos =
469
					sal::static_int_cast< sal_Int16 >((fGridWidth * 10000) / nFullWidthRelative);
470
471
				pSeparators[nBorder].Position =  nRelPos + nLastRelPos;
472
				pSeparators[nBorder].IsVisible = sal_True;
473
				nLastRelPos = nLastRelPos + nRelPos;
474
				++aSpansIter;
475
			}
476
	        TablePropertyMapPtr pPropMap( new TablePropertyMap );
477
		    pPropMap->Insert( PROP_TABLE_COLUMN_SEPARATORS, false, uno::makeAny( aSeparators ) );
456
        
478
        
457
#ifdef DEBUG_DOMAINMAPPER
479
#ifdef DEBUG_DOMAINMAPPER
458
        dmapper_logger->startElement("rowProperties");
480
	        dmapper_logger->startElement("rowProperties");
459
        dmapper_logger->addTag(pPropMap->toTag());
481
		    dmapper_logger->addTag(pPropMap->toTag());
460
        dmapper_logger->endElement("rowProperties");
482
			dmapper_logger->endElement("rowProperties");
461
#endif
483
#endif
462
        insertRowProps(pPropMap);
484
			insertRowProps(pPropMap);
485
		}
463
    }
486
    }
464
487
465
    ++m_nRow;
488
    ++m_nRow;
(-)source/dmapper/MeasureHandler.hxx (+3 lines)
Lines 53-58 Link Here
53
    //at least tables can have automatic width
53
    //at least tables can have automatic width
54
    bool isAutoWidth() const;
54
    bool isAutoWidth() const;
55
55
56
	sal_Int32 getValue() const { return m_nMeasureValue; }
57
	sal_Int32 getUnit() const { return m_nUnit; }
58
56
    sal_Int16 GetRowHeightSizeType() const { return m_nRowHeightSizeType;}
59
    sal_Int16 GetRowHeightSizeType() const { return m_nRowHeightSizeType;}
57
};
60
};
58
typedef boost::shared_ptr
61
typedef boost::shared_ptr
(-)source/dmapper/PropertyIds.cxx (+2 lines)
Lines 303-308 Link Here
303
            case PROP_CHAR_PROP_HEIGHT        :    sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharPropHeight")); break;
303
            case PROP_CHAR_PROP_HEIGHT        :    sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharPropHeight")); break;
304
            case PROP_CHAR_PROP_HEIGHT_ASIAN  :    sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharPropHeightAsian")); break;
304
            case PROP_CHAR_PROP_HEIGHT_ASIAN  :    sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharPropHeightAsian")); break;
305
            case PROP_CHAR_PROP_HEIGHT_COMPLEX:    sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharPropHeightComplex")); break;
305
            case PROP_CHAR_PROP_HEIGHT_COMPLEX:    sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CharPropHeightComplex")); break;
306
			case PROP_RELATIVE_WIDTH: sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RelativeWidth")); break;
307
			case PROP_IS_WIDTH_RELATIVE: sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("IsWidthRelative")); break;
306
            case PROP_FORMAT   :    sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Format")); break;
308
            case PROP_FORMAT   :    sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Format")); break;
307
            case PROP_INSERT   :    sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Insert")); break;
309
            case PROP_INSERT   :    sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Insert")); break;
308
            case PROP_DELETE   :    sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Delete")); break;
310
            case PROP_DELETE   :    sName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Delete")); break;
(-)source/dmapper/PropertyIds.hxx (+2 lines)
Lines 283-288 Link Here
283
        ,PROP_WIDTH
283
        ,PROP_WIDTH
284
        ,PROP_WIDTH_TYPE
284
        ,PROP_WIDTH_TYPE
285
        ,PROP_WRITING_MODE
285
        ,PROP_WRITING_MODE
286
		,PROP_RELATIVE_WIDTH
287
		,PROP_IS_WIDTH_RELATIVE
286
    };
288
    };
287
struct PropertyNameSupplier_Impl;
289
struct PropertyNameSupplier_Impl;
288
class PropertyNameSupplier
290
class PropertyNameSupplier
(-)source/dmapper/PropertyMap.hxx (+1 lines)
Lines 527-532 Link Here
527
        CELL_MAR_TOP,
527
        CELL_MAR_TOP,
528
        CELL_MAR_BOTTOM,
528
        CELL_MAR_BOTTOM,
529
        TABLE_WIDTH,
529
        TABLE_WIDTH,
530
		TABLE_WIDTH_TYPE,
530
        GAP_HALF,
531
        GAP_HALF,
531
        LEFT_MARGIN,
532
        LEFT_MARGIN,
532
        HORI_ORIENT,
533
        HORI_ORIENT,

Return to issue 121975