Kaydet (Commit) 80a72c4c authored tarafından Winfried Donkers's avatar Winfried Donkers Kaydeden (comit) Jan Holesovsky

fdo#44516: Improved label/BC wizard - set paper size

üst 765c6d99
......@@ -5068,6 +5068,24 @@
</info>
<value>0</value>
</prop>
<prop oor:name="PageWidth" oor:type="xs:int">
<!-- UIHints: File New Labels Format -->
<info>
<author>Winfried</author>
<desc>Specifies the page width of the label sheet [UNIT=1/100 mm].</desc>
<label>Page Width</label>
</info>
<value>10000</value>
</prop>
<prop oor:name="PageHeight" oor:type="xs:int">
<!-- UIHints: File New Labels Format -->
<info>
<author>Winfried</author>
<desc>Specifies the page height of the label sheet [UNIT=1/100 mm].</desc>
<label>Page Height</label>
</info>
<value>10000</value>
</prop>
</group>
<group oor:name="Option">
<info>
......
......@@ -63,22 +63,21 @@
#define RC_LABEL_END (RC_ENVELP_BEGIN + 49)
#define RC_LABFMT_BEGIN (RC_ENVELP_BEGIN + 50)
#define RC_LABFMT_END (RC_ENVELP_BEGIN + 59)
#define RC_LABFMT_END (RC_ENVELP_BEGIN + 62)
#define RC_LABPRT_BEGIN (RC_ENVELP_BEGIN + 60)
#define RC_LABPRT_END (RC_ENVELP_BEGIN + 69)
#define RC_LABPRT_BEGIN (RC_ENVELP_BEGIN + 63)
#define RC_LABPRT_END (RC_ENVELP_BEGIN + 72)
// Strings --------------------------------------------------------------------
#define STR_DATABASE_NOT_OPENED (RC_ENVLOP_BEGIN + 60)
#define STR_NO_DRIVERS (RC_ENVLOP_BEGIN + 61)
#define DLG_MERGE_CREATE (RC_ENVLOP_BEGIN + 62)
#define DLG_MERGE_FIELD_CONNECTIONS (RC_ENVLOP_BEGIN + 63)
#define STR_BTN_NEW_DOC (RC_ENVLOP_BEGIN + 64)
#define STR_BTN_NEWDOC (RC_ENVLOP_BEGIN + 65)
#define STR_SENDER_TOKENS (RC_ENVLOP_BEGIN + 66)
#define STR_DATABASE_NOT_OPENED (RC_ENVLOP_BEGIN + 63)
#define STR_NO_DRIVERS (RC_ENVLOP_BEGIN + 64)
#define DLG_MERGE_CREATE (RC_ENVLOP_BEGIN + 65)
#define DLG_MERGE_FIELD_CONNECTIONS (RC_ENVLOP_BEGIN + 66)
#define STR_BTN_NEW_DOC (RC_ENVLOP_BEGIN + 67)
#define STR_BTN_NEWDOC (RC_ENVLOP_BEGIN + 68)
#define STR_SENDER_TOKENS (RC_ENVLOP_BEGIN + 69)
// Ueberlaufpruefung ----------------------------------------------------------
#define ENVELP_ACT_END STR_SENDER_TOKENS
......
......@@ -250,8 +250,8 @@ void SwModule::InsertLab(SfxRequest& rReq, sal_Bool bLabel)
SvxULSpaceItem aULMargin( RES_UL_SPACE );
aLRMargin.SetLeft ((sal_uInt16) rItem.lLeft );
aULMargin.SetUpper((sal_uInt16) rItem.lUpper);
aLRMargin.SetRight(MINLAY/2);
aULMargin.SetLower(MINLAY/2);
aLRMargin.SetRight( 0 );
aULMargin.SetLower( 0 );
rFmt.SetFmtAttr(aLRMargin);
rFmt.SetFmtAttr(aULMargin);
......@@ -264,15 +264,11 @@ void SwModule::InsertLab(SfxRequest& rReq, sal_Bool bLabel)
aDesc.SetUseOn(nsUseOnPage::PD_ALL); // Site numbering
// fix (fdo36874) revised page size calculation
// Set page size
long lPgWidth, lPgHeight;
lPgWidth = (((rItem.lLeft + (rItem.nCols - 1) * rItem.lHDist + rItem.lWidth + rItem.lLeft) > MINLAY) ?
(rItem.lLeft + (rItem.nCols - 1) * rItem.lHDist + rItem.lWidth + rItem.lLeft) : MINLAY);
lPgHeight = (((rItem.lUpper + (rItem.nRows - 1) * rItem.lVDist + rItem.lHeight + rItem.lUpper) > MINLAY) ?
(rItem.lUpper + (rItem.nRows - 1) * rItem.lVDist + rItem.lHeight + rItem.lUpper) : MINLAY);
long lPgWidth, lPgHeight;
lPgWidth = (rItem.lPWidth > MINLAY ? rItem.lPWidth : MINLAY);
lPgHeight = (rItem.lPHeight > MINLAY ? rItem.lPHeight : MINLAY);
rFmt.SetFmtAttr( SwFmtFrmSize( ATT_FIX_SIZE, lPgWidth, lPgHeight ));
// Numbering type
SvxNumberType aType;
aType.SetNumberingType(SVX_NUM_NUMBER_NONE);
......@@ -287,10 +283,8 @@ void SwModule::InsertLab(SfxRequest& rReq, sal_Bool bLabel)
aItem.SetValue((sal_Int8)pPrt->GetPaperBin());
rFmt.SetFmtAttr(aItem);
// Determine orientation by calculating the width and height of the resulting page
const int nResultWidth = rItem.lHDist * (rItem.nCols - 1) + rItem.lWidth + rItem.lLeft;
const int nResultHeight = rItem.lVDist * (rItem.nRows - 1) + rItem.lHeight + rItem.lUpper;
aDesc.SetLandscape(nResultWidth > nResultHeight);
// Determine orientation of the resulting page
aDesc.SetLandscape(rItem.lPWidth > rItem.lPHeight);
pSh->ChgPageDesc( 0, aDesc );
......@@ -298,37 +292,38 @@ void SwModule::InsertLab(SfxRequest& rReq, sal_Bool bLabel)
SwFldMgr* pFldMgr = new SwFldMgr;
pFldMgr->SetEvalExpFlds(sal_False);
//fix(24446): To avoid that labels end up in unprintable area, we set
//borders accordingly. To keep the handling as good as possible, we
//don't set any border as hard attribute at the current paragraph template
//(so that formating works, because of character-bound borders). Then
//we set the default paragraph template using the unprintable area.
const long nMin = pPrt->GetPageOffset().X() - rItem.lLeft;
if ( nMin > 0 )
{
SvxLRSpaceItem aLR( RES_LR_SPACE );
pSh->SetAttr( aLR );
SwFmt *pStandard = pSh->GetTxtCollFromPool( RES_POOLCOLL_STANDARD );
aLR.SetLeft ( sal_uInt16(nMin) );
aLR.SetRight( sal_uInt16(nMin) );
pStandard->SetFmtAttr( aLR );
}
// Prepare border template
SwFrmFmt* pFmt = pSh->GetFrmFmtFromPool( RES_POOLFRM_LABEL );
SwFmtFrmSize aFrmSize( ATT_FIX_SIZE,
rItem.lHDist - (rItem.lHDist-rItem.lWidth),
rItem.lVDist - (rItem.lVDist-rItem.lHeight));
pFmt->SetFmtAttr(aFrmSize);
SwFrmFmt* pFmtEORow = pSh->GetFrmFmtFromPool( RES_POOLFRM_LABEL ); //new SwFrmFmt (*pFmt);
SwFrmFmt* pFmtEOCol = pSh->GetFrmFmtFromPool( RES_POOLFRM_LABEL ); //new SwFrmFmt (*pFmt);
SwFrmFmt* pFmtEOColEORow = pSh->GetFrmFmtFromPool( RES_POOLFRM_LABEL ); //new SwFrmFmt (*pFmt);
SvxLRSpaceItem aFrmLRSpace( 0, (sal_uInt16)(rItem.lHDist - rItem.lWidth),
0, 0,
RES_LR_SPACE);
pFmt->SetFmtAttr(aFrmLRSpace);
sal_Int32 iResultWidth = rItem.lLeft + (rItem.nCols - 1) * rItem.lHDist + rItem.lWidth - rItem.lPWidth;
sal_Int32 iResultHeight = rItem.lUpper + (rItem.nRows - 1) * rItem.lVDist + rItem.lHeight - rItem.lPHeight;
sal_Int32 iWidth = (iResultWidth > 0 ? rItem.lWidth - (iResultWidth / rItem.nCols) - 1 : rItem.lWidth);
sal_Int32 iHeight = (iResultHeight > 0 ? rItem.lHeight - (iResultHeight / rItem.nRows) - 1 : rItem.lHeight);
SwFmtFrmSize aFrmSize( ATT_FIX_SIZE, iWidth, iHeight );
SvxULSpaceItem aFrmULSpace( 0, (sal_uInt16)(rItem.lVDist - rItem.lHeight),
RES_UL_SPACE);
SvxULSpaceItem aFrmNoULSpace( 0, 0, RES_UL_SPACE);
SvxLRSpaceItem aFrmLRSpace( 0, (sal_uInt16)(rItem.lHDist - rItem.lWidth),
0, 0, RES_LR_SPACE);
SvxLRSpaceItem aFrmNoLRSpace( 0, 0, 0, 0, RES_LR_SPACE);
pFmt->SetFmtAttr( aFrmSize );
pFmt->SetFmtAttr(aFrmULSpace);
pFmt->SetFmtAttr(aFrmLRSpace);
pFmtEORow->SetFmtAttr( aFrmSize );
pFmtEORow->SetFmtAttr(aFrmULSpace);
pFmtEORow->SetFmtAttr(aFrmNoLRSpace);
pFmtEOCol->SetFmtAttr( aFrmSize );
pFmtEOCol->SetFmtAttr(aFrmNoULSpace);
pFmtEOCol->SetFmtAttr(aFrmLRSpace);
pFmtEOColEORow->SetFmtAttr( aFrmSize );
pFmtEOColEORow->SetFmtAttr(aFrmNoULSpace);
pFmtEOColEORow->SetFmtAttr(aFrmNoLRSpace);
const SwFrmFmt *pFirstFlyFmt = 0;
if ( rItem.bPage )
......@@ -336,18 +331,27 @@ void SwModule::InsertLab(SfxRequest& rReq, sal_Bool bLabel)
SwFmtVertOrient aFrmVertOrient( pFmt->GetVertOrient() );
aFrmVertOrient.SetVertOrient( text::VertOrientation::TOP );
pFmt->SetFmtAttr(aFrmVertOrient);
pFmtEORow->SetFmtAttr(aFrmVertOrient);
pFmtEOCol->SetFmtAttr(aFrmVertOrient);
pFmtEOColEORow->SetFmtAttr(aFrmVertOrient);
for ( sal_uInt16 i = 0; i < rItem.nRows; ++i )
{
for ( sal_uInt16 j = 0; j < rItem.nCols; ++j )
{
pSh->Push();
SwFrmFmt* pFrmFmt;
if ( j == rItem.nCols - 1 )
pFrmFmt = ( i == rItem.nRows - 1 ? pFmtEOColEORow : pFmtEORow );
else
pFrmFmt = ( i == rItem.nRows - 1 ? pFmtEOCol : pFmt );
const SwFrmFmt *pTmp =
bLabel ?
lcl_InsertLabText( *pSh, rItem, *pFmt, *pFldMgr, j, i,
i == rItem.nRows - 1 && j == rItem.nCols - 1,
sal_True ) :
lcl_InsertBCText(*pSh, rItem, *pFmt, j, i, sal_True);
lcl_InsertLabText( *pSh, rItem, *pFrmFmt, *pFldMgr, j, i,
i == rItem.nRows - 1 && j == rItem.nCols - 1, sal_True ) :
lcl_InsertBCText(*pSh, rItem, *pFrmFmt, j, i, sal_True);
if (!(i|j))
{
pFirstFlyFmt = pTmp;
......
......@@ -64,6 +64,8 @@ void SwLabRec::SetFromItem( const SwLabItem& rItem )
lUpper = rItem.lUpper;
nCols = rItem.nCols;
nRows = rItem.nRows;
lPWidth = rItem.lPWidth;
lPHeight = rItem.lPHeight;
bCont = rItem.bCont;
}
......@@ -76,6 +78,8 @@ void SwLabRec::FillItem( SwLabItem& rItem ) const
rItem.lLeft = lLeft;
rItem.lUpper = lUpper;
rItem.nCols = nCols;
rItem.lPWidth = lPWidth;
rItem.lPHeight = lPHeight;
rItem.nRows = nRows;
}
......
......@@ -77,6 +77,8 @@ SwLabRec* lcl_CreateSwLabRec(Sequence<Any>& rValues, const OUString& rManufactur
const Any* pValues = rValues.getConstArray();
OUString sTmp;
pNewRec->aMake = rManufacturer;
pNewRec->lPWidth = 0;
pNewRec->lPHeight = 0;
for(sal_Int32 nProp = 0; nProp < rValues.getLength(); nProp++)
{
if(pValues[nProp].hasValue())
......@@ -97,15 +99,17 @@ SwLabRec* lcl_CreateSwLabRec(Sequence<Any>& rValues, const OUString& rManufactur
int nVal = sToken.ToInt32();
switch(i)
{
case 0 : pNewRec->bCont = sToken.GetChar(0) == 'C'; break;
case 1 : pNewRec->lHDist = MM100_TO_TWIP(nVal);break;
case 2 : pNewRec->lVDist = MM100_TO_TWIP(nVal);break;
case 3 : pNewRec->lWidth = MM100_TO_TWIP(nVal);break;
case 4 : pNewRec->lHeight = MM100_TO_TWIP(nVal); break;
case 5 : pNewRec->lLeft = MM100_TO_TWIP(nVal);break;
case 6 : pNewRec->lUpper = MM100_TO_TWIP(nVal);break;
case 7 : pNewRec->nCols = nVal; break;
case 8 : pNewRec->nRows = nVal; break;
case 0 : pNewRec->bCont = sToken.GetChar(0) == 'C'; break;
case 1 : pNewRec->lHDist = MM100_TO_TWIP(nVal); break;
case 2 : pNewRec->lVDist = MM100_TO_TWIP(nVal); break;
case 3 : pNewRec->lWidth = MM100_TO_TWIP(nVal); break;
case 4 : pNewRec->lHeight = MM100_TO_TWIP(nVal); break;
case 5 : pNewRec->lLeft = MM100_TO_TWIP(nVal); break;
case 6 : pNewRec->lUpper = MM100_TO_TWIP(nVal); break;
case 7 : pNewRec->nCols = nVal; break;
case 8 : pNewRec->nRows = nVal; break;
case 9 : pNewRec->lPWidth = MM100_TO_TWIP(nVal); break;
case 10 : pNewRec->lPHeight = MM100_TO_TWIP(nVal); break;
}
}
}
......@@ -113,6 +117,13 @@ SwLabRec* lcl_CreateSwLabRec(Sequence<Any>& rValues, const OUString& rManufactur
}
}
}
// lines added for compatibility with custom label defintions saved before patch 44516
if (pNewRec->lPWidth == 0 || pNewRec->lPHeight == 0)
{
// old style definition (no paper dimensions), calculate probable values
pNewRec->lPWidth = 2 * pNewRec->lLeft + (pNewRec->nCols - 1) * pNewRec->lHDist + pNewRec->lWidth;
pNewRec->lPHeight = ( pNewRec->bCont ? pNewRec->nRows * pNewRec->lVDist : 2 * pNewRec->lUpper + (pNewRec->nRows - 1) * pNewRec->lVDist + pNewRec->lHeight );
}
return pNewRec;
}
......@@ -133,15 +144,17 @@ Sequence<PropertyValue> lcl_CreateProperties(
case 1:
{
OUString sTmp;
sTmp += C2U( rRec.bCont ? "C" : "S"); sTmp += sColon;
sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lHDist) ); sTmp += sColon;
sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lVDist)); sTmp += sColon;
sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lWidth) ); sTmp += sColon;
sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lHeight) ); sTmp += sColon;
sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lLeft) ); sTmp += sColon;
sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lUpper) ); sTmp += sColon;
sTmp += OUString::valueOf(rRec.nCols );sTmp += sColon;
sTmp += OUString::valueOf(rRec.nRows );
sTmp += C2U( rRec.bCont ? "C" : "S"); sTmp += sColon;
sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lHDist) ); sTmp += sColon;
sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lVDist)); sTmp += sColon;
sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lWidth) ); sTmp += sColon;
sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lHeight) ); sTmp += sColon;
sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lLeft) ); sTmp += sColon;
sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lUpper) ); sTmp += sColon;
sTmp += OUString::valueOf(rRec.nCols ); sTmp += sColon;
sTmp += OUString::valueOf(rRec.nRows ); sTmp += sColon;
sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lPWidth) ); sTmp += sColon;
sTmp += OUString::valueOf(TWIP_TO_MM100(rRec.lPHeight) );
pValues[nProp].Value <<= sTmp;
}
break;
......
......@@ -67,7 +67,9 @@ SwLabPreview::SwLabPreview( const SwLabFmtPage* pParent, const ResId& rResID ) :
aLeftStr (SW_RES(STR_LEFT )),
aUpperStr (SW_RES(STR_UPPER )),
aColsStr (SW_RES(STR_COLS )),
aRowsStr (SW_RES(STR_ROWS ))
aRowsStr (SW_RES(STR_ROWS )),
aPWidthStr (SW_RES(STR_PWIDTH )),
aPHeightStr(SW_RES(STR_PHEIGHT))
{
SetMapMode(MAP_PIXEL);
......@@ -92,7 +94,8 @@ SwLabPreview::SwLabPreview( const SwLabFmtPage* pParent, const ResId& rResID ) :
lLeftWidth = GetTextWidth(aLeftStr );
lUpperWidth = GetTextWidth(aUpperStr );
lColsWidth = GetTextWidth(aColsStr );
lPWidthWidth = GetTextWidth(aPWidthStr);
lPHeightWidth = GetTextWidth(aPHeightStr);
lXHeight = GetTextHeight();
lXWidth = GetTextWidth('X');
......@@ -170,7 +173,7 @@ void SwLabPreview::Paint(const Rectangle &)
// Labels
SetClipRegion (Rectangle(Point(lX0, lY0), Size(lOutlineW, lOutlineH)));
SetFillColor(rWinColor);
SetFillColor( Color( 0xE0, 0xE0, 0xFF ) );
for (sal_uInt16 nRow = 0; nRow < Min((sal_uInt16) 2, (sal_uInt16) aItem.nRows); nRow++)
for (sal_uInt16 nCol = 0; nCol < Min((sal_uInt16) 2, (sal_uInt16) aItem.nCols); nCol++)
DrawRect(Rectangle(
......@@ -321,6 +324,10 @@ SwLabFmtPage::SwLabFmtPage(Window* pParent, const SfxItemSet& rSet) :
aColsField (this, SW_RES(FLD_COLUMNS)),
aRowsText (this, SW_RES(TXT_ROWS )),
aRowsField (this, SW_RES(FLD_ROWS )),
aPWidthText (this, SW_RES(TXT_PWIDTH )),
aPWidthField (this, SW_RES(FLD_PWIDTH )),
aPHeightText (this, SW_RES(TXT_PHEIGHT )),
aPHeightField (this, SW_RES(FLD_PHEIGHT )),
aSavePB (this, SW_RES(PB_SAVE )),
bModified(sal_False),
aItem ((const SwLabItem&) rSet.Get(FN_LABEL))
......@@ -336,6 +343,8 @@ SwLabFmtPage::SwLabFmtPage(Window* pParent, const SfxItemSet& rSet) :
SetMetric(aHeightField, aMetric);
SetMetric(aLeftField , aMetric);
SetMetric(aUpperField , aMetric);
SetMetric(aPWidthField , aMetric);
SetMetric(aPHeightField, aMetric);
// Install handlers
Link aLk = LINK(this, SwLabFmtPage, ModifyHdl);
......@@ -347,6 +356,8 @@ SwLabFmtPage::SwLabFmtPage(Window* pParent, const SfxItemSet& rSet) :
aUpperField .SetModifyHdl( aLk );
aColsField .SetModifyHdl( aLk );
aRowsField .SetModifyHdl( aLk );
aPWidthField .SetModifyHdl( aLk );
aPHeightField.SetModifyHdl( aLk );
aLk = LINK(this, SwLabFmtPage, LoseFocusHdl);
aHDistField .SetLoseFocusHdl( aLk );
......@@ -357,6 +368,8 @@ SwLabFmtPage::SwLabFmtPage(Window* pParent, const SfxItemSet& rSet) :
aUpperField .SetLoseFocusHdl( aLk );
aColsField .SetLoseFocusHdl( aLk );
aRowsField .SetLoseFocusHdl( aLk );
aPWidthField .SetLoseFocusHdl( aLk );
aPHeightField.SetLoseFocusHdl( aLk );
aSavePB.SetClickHdl( LINK (this, SwLabFmtPage, SaveHdl));
// Set timer
......@@ -401,21 +414,26 @@ IMPL_LINK_INLINE_END( SwLabFmtPage, LoseFocusHdl, Control *, pControl )
void SwLabFmtPage::ChangeMinMax()
{
long lMax = 31748; // 56 cm
long nMinSize = 10; // 0,1cm
// Min and Max
long lLeft = static_cast< long >(GETFLDVAL(aLeftField )),
lUpper = static_cast< long >(GETFLDVAL(aUpperField)),
lHDist = static_cast< long >(GETFLDVAL(aHDistField)),
lVDist = static_cast< long >(GETFLDVAL(aVDistField));
long nMinSize = 10; // 0,1cm
int nCols = aColsField.GetValue(),
nRows = aRowsField.GetValue();
long lLeft = static_cast< long >(GETFLDVAL(aLeftField )),
lUpper = static_cast< long >(GETFLDVAL(aUpperField)),
lHDist = static_cast< long >(GETFLDVAL(aHDistField)),
lVDist = static_cast< long >(GETFLDVAL(aVDistField)),
lWidth = static_cast< long >(GETFLDVAL(aWidthField)),
lHeight = static_cast< long >(GETFLDVAL(aHeightField)),
lMinPWidth = lLeft + (nCols - 1) * lHDist + lWidth,
lMinPHeight = lUpper + (nRows - 1) * lVDist + lHeight;
aHDistField .SetMin(nMinSize, FUNIT_CM);
aVDistField .SetMin(nMinSize, FUNIT_CM);
aHDistField .SetMax((long) 100 * ((lMax - lLeft ) / Max(1L, (long) aColsField.GetValue())), FUNIT_TWIP);
aVDistField .SetMax((long) 100 * ((lMax - lUpper) / Max(1L, (long) aRowsField.GetValue())), FUNIT_TWIP);
aHDistField .SetMax((long) 100 * ((lMax - lLeft ) / Max(1L, (long) nCols)), FUNIT_TWIP);
aVDistField .SetMax((long) 100 * ((lMax - lUpper) / Max(1L, (long) nRows)), FUNIT_TWIP);
aWidthField .SetMin(nMinSize, FUNIT_CM);
aHeightField.SetMin(nMinSize, FUNIT_CM);
......@@ -423,12 +441,19 @@ void SwLabFmtPage::ChangeMinMax()
aWidthField .SetMax((long) 100 * (lHDist), FUNIT_TWIP);
aHeightField.SetMax((long) 100 * (lVDist), FUNIT_TWIP);
aLeftField .SetMax((long) 100 * (lMax - (long) aColsField.GetValue() * GETFLDVAL(aHDistField)), FUNIT_TWIP);
aUpperField .SetMax((long) 100 * (lMax - (long) aRowsField.GetValue() * GETFLDVAL(aVDistField)), FUNIT_TWIP);
aLeftField .SetMax((long) 100 * (lMax - nCols * lHDist), FUNIT_TWIP);
aUpperField .SetMax((long) 100 * (lMax - nRows * lVDist), FUNIT_TWIP);
aColsField .SetMin( 1 );
aRowsField .SetMin( 1 );
aColsField .SetMax((lMax - lLeft ) / Max(1L, lHDist));
aRowsField .SetMax((lMax - lUpper) / Max(1L, lVDist));
aPWidthField .SetMin( (long) 100 * lMinPWidth, FUNIT_TWIP );
aPHeightField.SetMin( (long) 100 * lMinPHeight, FUNIT_TWIP );
aPWidthField .SetMax( (long) 100 * lMax, FUNIT_TWIP);
aPHeightField.SetMax( (long) 100 * lMax, FUNIT_TWIP);
// First and Last
aHDistField .SetFirst(aHDistField .GetMin());
......@@ -448,7 +473,11 @@ void SwLabFmtPage::ChangeMinMax()
aColsField .SetLast (aColsField .GetMax());
aRowsField .SetLast (aRowsField .GetMax());
aPWidthField .SetFirst(aPWidthField .GetMin());
aPHeightField.SetFirst(aPHeightField.GetMin());
aPWidthField .SetLast (aPWidthField .GetMax());
aPHeightField.SetLast (aPHeightField.GetMax());
aHDistField .Reformat();
aVDistField .Reformat();
aWidthField .Reformat();
......@@ -457,6 +486,8 @@ void SwLabFmtPage::ChangeMinMax()
aUpperField .Reformat();
aColsField .Reformat();
aRowsField .Reformat();
aPWidthField .Reformat();
aPHeightField.Reformat();
}
SfxTabPage* SwLabFmtPage::Create(Window* pParent, const SfxItemSet& rSet)
......@@ -493,6 +524,8 @@ void SwLabFmtPage::FillItem(SwLabItem& rItem)
rItem.lUpper = rRec.lUpper = static_cast< long >(GETFLDVAL(aUpperField ));
rItem.nCols = rRec.nCols = (sal_uInt16) aColsField.GetValue();
rItem.nRows = rRec.nRows = (sal_uInt16) aRowsField.GetValue();
rItem.lPWidth = rRec.lPWidth = static_cast< long >(GETFLDVAL(aPWidthField ));
rItem.lPHeight = rRec.lPHeight = static_cast< long >(GETFLDVAL(aPHeightField));
}
}
......@@ -515,6 +548,8 @@ void SwLabFmtPage::Reset(const SfxItemSet& )
aHeightField.SetMax(100 * aItem.lHeight, FUNIT_TWIP);
aLeftField .SetMax(100 * aItem.lLeft , FUNIT_TWIP);
aUpperField .SetMax(100 * aItem.lUpper , FUNIT_TWIP);
aPWidthField .SetMax(100 * aItem.lPWidth , FUNIT_TWIP);
aPHeightField.SetMax(100 * aItem.lPHeight, FUNIT_TWIP);
SETFLDVAL(aHDistField , aItem.lHDist );
SETFLDVAL(aVDistField , aItem.lVDist );
......@@ -522,6 +557,8 @@ void SwLabFmtPage::Reset(const SfxItemSet& )
SETFLDVAL(aHeightField, aItem.lHeight);
SETFLDVAL(aLeftField , aItem.lLeft );
SETFLDVAL(aUpperField , aItem.lUpper );
SETFLDVAL(aPWidthField , aItem.lPWidth );
SETFLDVAL(aPHeightField, aItem.lPHeight);
aColsField.SetMax(aItem.nCols);
aRowsField.SetMax(aItem.nRows);
......@@ -544,6 +581,8 @@ IMPL_LINK( SwLabFmtPage, SaveHdl, PushButton *, EMPTYARG )
aRec.lUpper = static_cast< long >(GETFLDVAL(aUpperField ));
aRec.nCols = (sal_uInt16) aColsField.GetValue();
aRec.nRows = (sal_uInt16) aRowsField.GetValue();
aRec.lPWidth = static_cast< long >(GETFLDVAL(aPWidthField ));
aRec.lPHeight = static_cast< long >(GETFLDVAL(aPHeightField));
aRec.bCont = aItem.bCont;
SwSaveLabelDlg* pSaveDlg = new SwSaveLabelDlg(this, aRec);
pSaveDlg->SetLabel(aItem.aLstMake, aItem.aLstType);
......@@ -644,6 +683,8 @@ sal_Bool SwSaveLabelDlg::GetLabel(SwLabItem& rItem)
rItem.lUpper = rLabRec.lUpper;
rItem.nCols = rLabRec.nCols;
rItem.nRows = rLabRec.nRows;
rItem.lPWidth = rLabRec.lPWidth;
rItem.lPHeight = rLabRec.lPHeight;
}
return bSuccess;
}
......
......@@ -49,12 +49,16 @@
#define FLD_COLUMNS 15
#define TXT_ROWS 16
#define FLD_ROWS 17
#define FL_NONAME 18
#define PB_SAVE 19
#define FI_MAKE 20
#define FI_TYPE 21
#define TXT_PWIDTH 18
#define FLD_PWIDTH 19
#define TXT_PHEIGHT 20
#define FLD_PHEIGHT 21
#define FL_NONAME 22
#define PB_SAVE 23
#define FI_MAKE 24
#define FI_TYPE 25
#define FL_OPTIONS 1
#define FL_OPTIONS 1
#define FT_MAKE 2
#define CB_MAKE 3
#define FT_TYPE 4
......@@ -66,18 +70,20 @@
// global resources ********************************************************
#define STR_HDIST (RC_LABFMT_BEGIN + 1)
#define STR_VDIST (RC_LABFMT_BEGIN + 2)
#define STR_WIDTH (RC_LABFMT_BEGIN + 3)
#define STR_HEIGHT (RC_LABFMT_BEGIN + 4)
#define STR_LEFT (RC_LABFMT_BEGIN + 5)
#define STR_UPPER (RC_LABFMT_BEGIN + 6)
#define STR_COLS (RC_LABFMT_BEGIN + 7)
#define STR_ROWS (RC_LABFMT_BEGIN + 8)
#define STR_HDIST (RC_LABFMT_BEGIN + 1)
#define STR_VDIST (RC_LABFMT_BEGIN + 2)
#define STR_WIDTH (RC_LABFMT_BEGIN + 3)
#define STR_HEIGHT (RC_LABFMT_BEGIN + 4)
#define STR_LEFT (RC_LABFMT_BEGIN + 5)
#define STR_UPPER (RC_LABFMT_BEGIN + 6)
#define STR_COLS (RC_LABFMT_BEGIN + 7)
#define STR_ROWS (RC_LABFMT_BEGIN + 8)
#define STR_PWIDTH (RC_LABFMT_BEGIN + 9)
#define STR_PHEIGHT (RC_LABFMT_BEGIN + 10)
// overflow check ********************************************************
#define LABFMT_ACT_END STR_ROWS
#define LABFMT_ACT_END STR_PHEIGHT
#if LABFMT_ACT_END > RC_LABFMT_END
#error Resource-Ueberlauf in #file, #line
......
......@@ -52,6 +52,8 @@ class SwLabPreview : public Window
String aUpperStr;
String aColsStr;
String aRowsStr;
String aPWidthStr;
String aPHeightStr;
long lHDistWidth;
long lVDistWidth;
......@@ -59,6 +61,9 @@ class SwLabPreview : public Window
long lLeftWidth;
long lUpperWidth;
long lColsWidth;
long PRowsWidth;
long lPWidthWidth;
long lPHeightWidth;
long lXWidth;
long lXHeight;
......@@ -105,6 +110,10 @@ class SwLabFmtPage : public SfxTabPage
NumericField aColsField;
FixedText aRowsText;
NumericField aRowsField;
FixedText aPWidthText;
MetricField aPWidthField;
FixedText aPHeightText;
MetricField aPHeightField;
PushButton aSavePB;
Timer aPreviewTimer;
......
......@@ -51,7 +51,7 @@ TabPage TP_LAB_FMT
};
FixedText TXT_HDIST
{
Pos = MAP_APPFONT ( 6 , 19 ) ;
Pos = MAP_APPFONT ( 6 , 6 ) ;
Size = MAP_APPFONT ( 50 , 8 ) ;
Text [ en-US ] = "Hori~zontal pitch" ;
Group = TRUE ;
......@@ -61,7 +61,7 @@ TabPage TP_LAB_FMT
{
HelpID = "sw:MetricField:TP_LAB_FMT:FLD_HDIST";
Border = TRUE ;
Pos = MAP_APPFONT ( 60 , 17 ) ;
Pos = MAP_APPFONT ( 60 , 4 ) ;
Size = MAP_APPFONT ( 40 , 12 ) ;
TabStop = TRUE ;
Left = TRUE ;
......@@ -73,7 +73,7 @@ TabPage TP_LAB_FMT
};
FixedText TXT_VDIST
{
Pos = MAP_APPFONT ( 6 , 35 ) ;
Pos = MAP_APPFONT ( 6 , 22 ) ;
Size = MAP_APPFONT ( 50 , 8 ) ;
Text [ en-US ] = "~Vertical pitch" ;
Left = TRUE ;
......@@ -82,7 +82,7 @@ TabPage TP_LAB_FMT
{
HelpID = "sw:MetricField:TP_LAB_FMT:FLD_VDIST";
Border = TRUE ;
Pos = MAP_APPFONT ( 60 , 33 ) ;
Pos = MAP_APPFONT ( 60 , 20 ) ;
Size = MAP_APPFONT ( 40 , 12 ) ;
TabStop = TRUE ;
Left = TRUE ;
......@@ -94,7 +94,7 @@ TabPage TP_LAB_FMT
};
FixedText TXT_WIDTH
{
Pos = MAP_APPFONT ( 6 , 51 ) ;
Pos = MAP_APPFONT ( 6 , 38 ) ;
Size = MAP_APPFONT ( 50 , 8 ) ;
Text [ en-US ] = "~Width" ;
Left = TRUE ;
......@@ -103,7 +103,7 @@ TabPage TP_LAB_FMT
{
HelpID = "sw:MetricField:TP_LAB_FMT:FLD_WIDTH";
Border = TRUE ;
Pos = MAP_APPFONT ( 60 , 49 ) ;
Pos = MAP_APPFONT ( 60 , 36 ) ;
Size = MAP_APPFONT ( 40 , 12 ) ;
TabStop = TRUE ;
Left = TRUE ;
......@@ -115,7 +115,7 @@ TabPage TP_LAB_FMT
};
FixedText TXT_HEIGHT
{
Pos = MAP_APPFONT ( 6 , 67 ) ;
Pos = MAP_APPFONT ( 6 , 54 ) ;
Size = MAP_APPFONT ( 50 , 8 ) ;
Text [ en-US ] = "~Height" ;
Left = TRUE ;
......@@ -124,7 +124,7 @@ TabPage TP_LAB_FMT
{
HelpID = "sw:MetricField:TP_LAB_FMT:FLD_HEIGHT";
Border = TRUE ;
Pos = MAP_APPFONT ( 60 , 65 ) ;
Pos = MAP_APPFONT ( 60 , 52 ) ;
Size = MAP_APPFONT ( 40 , 12 ) ;
TabStop = TRUE ;
Left = TRUE ;
......@@ -136,7 +136,7 @@ TabPage TP_LAB_FMT
};
FixedText TXT_LEFT
{
Pos = MAP_APPFONT ( 6 , 83 ) ;
Pos = MAP_APPFONT ( 6 , 70 ) ;
Size = MAP_APPFONT ( 50 , 8 ) ;
Text [ en-US ] = "~Left margin" ;
Left = TRUE ;
......@@ -145,7 +145,7 @@ TabPage TP_LAB_FMT
{
HelpID = "sw:MetricField:TP_LAB_FMT:FLD_LEFT";
Border = TRUE ;
Pos = MAP_APPFONT ( 60 , 81 ) ;
Pos = MAP_APPFONT ( 60 , 68 ) ;
Size = MAP_APPFONT ( 40 , 12 ) ;
TabStop = TRUE ;
Left = TRUE ;
......@@ -159,7 +159,7 @@ TabPage TP_LAB_FMT
};
FixedText TXT_UPPER
{
Pos = MAP_APPFONT ( 6 , 99 ) ;
Pos = MAP_APPFONT ( 6 , 86 ) ;
Size = MAP_APPFONT ( 50 , 8 ) ;
Text [ en-US ] = "~Top margin" ;
Left = TRUE ;
......@@ -168,7 +168,7 @@ TabPage TP_LAB_FMT
{
HelpID = "sw:MetricField:TP_LAB_FMT:FLD_UPPER";
Border = TRUE ;
Pos = MAP_APPFONT ( 60 , 97 ) ;
Pos = MAP_APPFONT ( 60 , 84 ) ;
Size = MAP_APPFONT ( 40 , 12 ) ;
TabStop = TRUE ;
Left = TRUE ;
......@@ -182,7 +182,7 @@ TabPage TP_LAB_FMT
};
FixedText TXT_COLUMNS
{
Pos = MAP_APPFONT ( 6 , 115 ) ;
Pos = MAP_APPFONT ( 6 , 102 ) ;
Size = MAP_APPFONT ( 50 , 8 ) ;
Text [ en-US ] = "~Columns" ;
Left = TRUE ;
......@@ -191,7 +191,7 @@ TabPage TP_LAB_FMT
{
HelpID = "sw:NumericField:TP_LAB_FMT:FLD_COLUMNS";
Border = TRUE ;
Pos = MAP_APPFONT ( 60 , 113 ) ;
Pos = MAP_APPFONT ( 60 , 100 ) ;
Size = MAP_APPFONT ( 40 , 12 ) ;
TabStop = TRUE ;
Left = TRUE ;
......@@ -202,7 +202,7 @@ TabPage TP_LAB_FMT
};
FixedText TXT_ROWS
{
Pos = MAP_APPFONT ( 6 , 131 ) ;
Pos = MAP_APPFONT ( 6 , 118 ) ;
Size = MAP_APPFONT ( 50 , 8 ) ;
Text [ en-US ] = "R~ows" ;
Left = TRUE ;
......@@ -211,7 +211,7 @@ TabPage TP_LAB_FMT
{
HelpID = "sw:NumericField:TP_LAB_FMT:FLD_ROWS";
Border = TRUE ;
Pos = MAP_APPFONT ( 60 , 129 ) ;
Pos = MAP_APPFONT ( 60 , 116 ) ;
Size = MAP_APPFONT ( 40 , 12 ) ;
TabStop = TRUE ;
Left = TRUE ;
......@@ -220,10 +220,52 @@ TabPage TP_LAB_FMT
Minimum = 1 ;
First = 1 ;
};
FixedText TXT_PWIDTH
{
Pos = MAP_APPFONT ( 6 , 134 ) ;
Size = MAP_APPFONT ( 50 , 8 ) ;
Text [ en-US ] = "P~age Width" ;
Left = TRUE ;
};
MetricField FLD_PWIDTH
{
HelpID = "sw:MetricField:TP_LAB_FMT:FLD_PWIDTH";
Border = TRUE ;
Pos = MAP_APPFONT ( 60 , 132 ) ;
Size = MAP_APPFONT ( 40 , 12 ) ;
TabStop = TRUE ;
Left = TRUE ;
Spin = TRUE ;
DecimalDigits = 2 ;
Unit = FUNIT_CM ;
Repeat = TRUE ;
SpinSize = 10 ;
};
FixedText TXT_PHEIGHT
{
Pos = MAP_APPFONT ( 6 , 150 ) ;
Size = MAP_APPFONT ( 50 , 8 ) ;
Text [ en-US ] = "Pa~ge Height" ;
Left = TRUE ;
};
MetricField FLD_PHEIGHT
{
HelpID = "sw:MetricField:TP_LAB_FMT:FLD_PHEIGHT";
Border = TRUE ;
Pos = MAP_APPFONT ( 60 , 148 ) ;
Size = MAP_APPFONT ( 40 , 12 ) ;
TabStop = TRUE ;
Left = TRUE ;
Spin = TRUE ;
DecimalDigits = 2 ;
Unit = FUNIT_CM ;
Repeat = TRUE ;
SpinSize = 10 ;
};
PushButton PB_SAVE
{
HelpID = "sw:PushButton:TP_LAB_FMT:PB_SAVE";
Pos = MAP_APPFONT ( 50 , 148 ) ;
Pos = MAP_APPFONT ( 50 , 167 ) ;
Size = MAP_APPFONT ( 50 , 14 ) ;
Text [ en-US ] = "~Save...";
};
......@@ -261,6 +303,14 @@ String STR_ROWS
{
Text [ en-US ] = "Rows" ;
};
String STR_PWIDTH
{
Text [ en-US ] = "Page Width" ;
};
String STR_PHEIGHT
{
Text [ en-US ] = "Page Height" ;
};
ModalDialog DLG_SAVE_LABEL
{
HelpID = HID_SAVE_LABEL_DLG ;
......
This diff is collapsed.
......@@ -105,6 +105,8 @@ public:
long lHeight;
long lLeft;
long lUpper;
long lPWidth;
long lPHeight;
sal_Int32 nCols;
sal_Int32 nRows;
sal_Bool bCont;
......
......@@ -68,6 +68,8 @@ public:
sal_Int32 nRows; // number of rows (user)
sal_Int32 nCol; // column for single print
sal_Int32 nRow; // row for single print
sal_Int32 lPHeight; // paper height
sal_Int32 lPWidth; // paper width
sal_Bool bAddr;// address as label?
sal_Bool bCont;// continuous paper?
sal_Bool bPage;// whole page or single labels?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment