diff options
Diffstat (limited to 'sw/source/ui/frmdlg')
-rw-r--r-- | sw/source/ui/frmdlg/colex.cxx | 610 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/colmgr.cxx | 191 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/column.cxx | 1498 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/column.hrc | 86 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/column.src | 431 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/cption.cxx | 652 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/cption.hrc | 78 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/cption.src | 342 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/frmdlg.cxx | 221 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/frmmgr.cxx | 629 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/frmpage.cxx | 3345 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/frmpage.hrc | 146 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/frmpage.src | 884 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/frmui.src | 133 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/pattern.cxx | 75 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/pattern.hrc | 46 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/uiborder.cxx | 79 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/wrap.cxx | 785 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/wrap.hrc | 66 | ||||
-rw-r--r-- | sw/source/ui/frmdlg/wrap.src | 271 |
20 files changed, 10568 insertions, 0 deletions
diff --git a/sw/source/ui/frmdlg/colex.cxx b/sw/source/ui/frmdlg/colex.cxx new file mode 100644 index 000000000000..f9b3a678f8f2 --- /dev/null +++ b/sw/source/ui/frmdlg/colex.cxx @@ -0,0 +1,610 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + + + + +#include "cmdid.h" +#include "hintids.hxx" +#include <algorithm> + + +#include <svl/eitem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/ulspitem.hxx> +#include <editeng/sizeitem.hxx> +#include <svx/pageitem.hxx> +#include <editeng/brshitem.hxx> +#include <editeng/frmdiritem.hxx> +#include <vcl/bitmap.hxx> +#include <vcl/graph.hxx> +#include <tgrditem.hxx> +#include <viewopt.hxx> +#include "colex.hxx" +#include "colmgr.hxx" + +/*----------------------------------------------------------------------- + Beschreibung: Uebernahme der aktualisierten Werte aus dem Set + -----------------------------------------------------------------------*/ +void SwPageExample::UpdateExample( const SfxItemSet& rSet ) +{ + const SvxPageItem* pPage = 0; + SfxItemPool* pPool = rSet.GetPool(); + sal_uInt16 nWhich = pPool->GetWhich( SID_ATTR_PAGE ); + + if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET ) + { + // Ausrichtung + pPage = (const SvxPageItem*)&rSet.Get( nWhich ); + + if ( pPage ) + SetUsage( pPage->GetPageUsage() ); + } + + nWhich = pPool->GetWhich( SID_ATTR_PAGE_SIZE ); + + if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET ) + { + // Orientation und Size aus dem PageItem + const SvxSizeItem& rSize = (const SvxSizeItem&)rSet.Get( nWhich ); + SetSize( rSize.GetSize() ); + } + nWhich = RES_LR_SPACE; + if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET ) + { + // linken und rechten Rand einstellen + const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&)rSet.Get( nWhich ); + + SetLeft( rLRSpace.GetLeft() ); + SetRight( rLRSpace.GetRight() ); + } + else + { + SetLeft( 0 ); + SetRight( 0 ); + } + + nWhich = RES_UL_SPACE; + + if ( rSet.GetItemState( nWhich, sal_False ) == SFX_ITEM_SET ) + { + // oberen und unteren Rand einstellen + const SvxULSpaceItem& rULSpace = (const SvxULSpaceItem&)rSet.Get( nWhich ); + + SetTop( rULSpace.GetUpper() ); + SetBottom( rULSpace.GetLower() ); + } + else + { + SetTop( 0 ); + SetBottom( 0 ); + } + + + // Kopfzeilen-Attribute auswerten + const SfxPoolItem* pItem; + if( SFX_ITEM_SET == rSet.GetItemState( pPool->GetWhich( SID_ATTR_PAGE_HEADERSET), + sal_False, &pItem ) ) + { + const SfxItemSet& rHeaderSet = ((SvxSetItem*)pItem)->GetItemSet(); + const SfxBoolItem& rHeaderOn = + (const SfxBoolItem&)rHeaderSet.Get( pPool->GetWhich( SID_ATTR_PAGE_ON ) ); + + if ( rHeaderOn.GetValue() ) + { + const SvxSizeItem& rSize = + (const SvxSizeItem&)rHeaderSet.Get(pPool->GetWhich(SID_ATTR_PAGE_SIZE)); + + const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)rHeaderSet.Get( + pPool->GetWhich(SID_ATTR_ULSPACE)); + const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)rHeaderSet.Get( + pPool->GetWhich(SID_ATTR_LRSPACE)); + + SetHdHeight( rSize.GetSize().Height() - rUL.GetLower()); + SetHdDist( rUL.GetLower() ); + SetHdLeft( rLR.GetLeft() ); + SetHdRight( rLR.GetRight() ); + SetHeader( sal_True ); + if ( rHeaderSet.GetItemState( RES_BACKGROUND ) == SFX_ITEM_SET ) + { + const SvxBrushItem& rItem = + (const SvxBrushItem&)rHeaderSet.Get( RES_BACKGROUND ); + SetHdColor( rItem.GetColor() ); + } + if ( rHeaderSet.GetItemState( RES_BOX ) == SFX_ITEM_SET ) + { + const SvxBoxItem& rItem = + (const SvxBoxItem&)rHeaderSet.Get( RES_BOX ); + SetHdBorder( rItem ); + } + } + else + SetHeader( sal_False ); + } + + if( SFX_ITEM_SET == rSet.GetItemState( pPool->GetWhich( SID_ATTR_PAGE_FOOTERSET), + sal_False, &pItem ) ) + { + const SfxItemSet& rFooterSet = ((SvxSetItem*)pItem)->GetItemSet(); + const SfxBoolItem& rFooterOn = + (const SfxBoolItem&)rFooterSet.Get( SID_ATTR_PAGE_ON ); + + if ( rFooterOn.GetValue() ) + { + const SvxSizeItem& rSize = + (const SvxSizeItem&)rFooterSet.Get( pPool->GetWhich( SID_ATTR_PAGE_SIZE ) ); + + const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)rFooterSet.Get( + pPool->GetWhich( SID_ATTR_ULSPACE ) ); + const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)rFooterSet.Get( + pPool->GetWhich( SID_ATTR_LRSPACE ) ); + + SetFtHeight( rSize.GetSize().Height() - rUL.GetUpper()); + SetFtDist( rUL.GetUpper() ); + SetFtLeft( rLR.GetLeft() ); + SetFtRight( rLR.GetRight() ); + SetFooter( sal_True ); + if( rFooterSet.GetItemState( RES_BACKGROUND ) == SFX_ITEM_SET ) + { + const SvxBrushItem& rItem = + (const SvxBrushItem&)rFooterSet.Get( RES_BACKGROUND ); + SetFtColor( rItem.GetColor() ); + } + if( rFooterSet.GetItemState( RES_BOX ) == SFX_ITEM_SET ) + { + const SvxBoxItem& rItem = + (const SvxBoxItem&)rFooterSet.Get( RES_BOX ); + SetFtBorder( rItem ); + } + } + else + SetFooter( sal_False ); + } + if( SFX_ITEM_SET == rSet.GetItemState( RES_BACKGROUND, + sal_False, &pItem ) ) + { + SetColor( ( (const SvxBrushItem*)pItem )->GetColor() ); + const Graphic* pGrf = ( (const SvxBrushItem*)pItem )->GetGraphic(); + + if ( pGrf ) + { + Bitmap aBitmap = pGrf->GetBitmap(); + SetBitmap( &aBitmap ); + } + else + SetBitmap( NULL ); + } + + Invalidate(); +} +/*----------------------------------------------------------------------- + Beschreibung: + -----------------------------------------------------------------------*/ + + +void SwColExample::DrawPage( const Point& rOrg, + const sal_Bool bSecond, + const sal_Bool bEnabled ) +{ + SwPageExample::DrawPage( rOrg, bSecond, bEnabled ); + sal_uInt16 nColumnCount; + if( pColMgr && 0 != (nColumnCount = pColMgr->GetCount())) + { + long nL = GetLeft(); + long nR = GetRight(); + + if ( GetUsage() == SVX_PAGE_MIRROR && !bSecond ) + { + // fuer gespiegelt drehen + nL = GetRight(); + nR = GetLeft(); + } + + SetFillColor( Color( COL_LIGHTGRAY ) ); + Rectangle aRect; + aRect.Right() = rOrg.X() + GetSize().Width() - nR; + aRect.Left() = rOrg.X() + nL; + aRect.Top() = rOrg.Y() + GetTop() + + GetHdHeight() + GetHdDist(); + aRect.Bottom()= rOrg.Y() + GetSize().Height() - GetBottom() + - GetFtHeight() - GetFtDist(); + DrawRect(aRect); + + if(GetColor() == Color(COL_TRANSPARENT)) + { + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + const Color& rFieldColor = rStyleSettings.GetFieldColor(); + SetFillColor( rFieldColor ); + } + else + SetFillColor( GetColor() ); + + // #97495# make sure that the automatic column widht's are always equal + sal_Bool bAutoWidth = pColMgr->IsAutoWidth(); + sal_Int32 nAutoColWidth = 0; + if(bAutoWidth) + { + sal_Int32 nColumnWidthSum = 0; + sal_uInt16 i; + for(i = 0; i < nColumnCount; ++i) + nColumnWidthSum += pColMgr->GetColWidth( i ); + nAutoColWidth = nColumnWidthSum / nColumnCount; + } + + sal_uInt16 i; + for( i = 0; i < nColumnCount; i++) + { + if(!bAutoWidth) + nAutoColWidth = pColMgr->GetColWidth( i ); + aRect.Right() = aRect.Left() + nAutoColWidth; + DrawRect(aRect); + if(i < nColumnCount - 1) + aRect.Left() = aRect.Right() + pColMgr->GetGutterWidth(i); + } + if(pColMgr->HasLine()) + { + Point aUp( rOrg.X() + nL, rOrg.Y() + GetTop() ); + Point aDown( rOrg.X() + nL, rOrg.Y() + GetSize().Height() + - GetBottom() - GetFtHeight() - GetFtDist() ); + + if( pColMgr->GetLineHeightPercent() != 100 ) + { + long nLength = aDown.Y() - aUp.Y(); + nLength -= nLength * pColMgr->GetLineHeightPercent() / 100; + switch(pColMgr->GetAdjust()) + { + case COLADJ_BOTTOM: aUp.Y() += nLength; break; + case COLADJ_TOP: aDown.Y() -= nLength; break; + case COLADJ_CENTER: + aUp.Y() += nLength / 2; + aDown.Y() -= nLength / 2; + break; + default:; // prevent warning + } + } + + int nDist; + for( i = 0; i < nColumnCount - 1; i++) + { + int nGutter = pColMgr->GetGutterWidth(i); + nDist = pColMgr->GetColWidth( i ) + nGutter; + nDist -= (i == 0) ? + nGutter/2 : + 0; + aUp.X() += nDist; + aDown.X() += nDist; + DrawLine( aUp, aDown ); + + } + } + } +} + +/*-----------------25.10.96 09.15------------------- + +--------------------------------------------------*/ + + +SwColumnOnlyExample::SwColumnOnlyExample( Window* pParent, const ResId& rResId) : + Window(pParent, rResId), + m_aFrmSize(1,1) +{ + SetMapMode( MapMode( MAP_TWIP ) ); + m_aWinSize = GetOutputSizePixel(); + m_aWinSize.Height() -= 4; + m_aWinSize.Width() -= 4; + + m_aWinSize = PixelToLogic( m_aWinSize ); + + SetBorderStyle( WINDOW_BORDER_MONO ); + + m_aFrmSize = SvxPaperInfo::GetPaperSize(PAPER_A4);// DIN A4 + ::FitToActualSize(m_aCols, (sal_uInt16)m_aFrmSize.Width()); + + long nHeight = m_aFrmSize.Height(); + Fraction aScale( m_aWinSize.Height(), nHeight ); + MapMode aMapMode( GetMapMode() ); + aMapMode.SetScaleX( aScale ); + aMapMode.SetScaleY( aScale ); + SetMapMode( aMapMode ); +} + +/*-----------------25.10.96 09.16------------------- + +--------------------------------------------------*/ + + +void SwColumnOnlyExample::Paint( const Rectangle& /*rRect*/ ) +{ + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + const Color& rFieldColor = rStyleSettings.GetFieldColor(); + const Color& rDlgColor = rStyleSettings.GetDialogColor(); + const Color& rFieldTextColor = SwViewOption::GetFontColor(); + Color aGrayColor(COL_LIGHTGRAY); + if(rFieldColor == aGrayColor) + aGrayColor.Invert(); + + Size aLogSize(PixelToLogic(GetOutputSizePixel())); + Rectangle aCompleteRect(Point(0,0), aLogSize); + SetLineColor(rDlgColor); + SetFillColor(rDlgColor); + DrawRect(aCompleteRect); + + SetLineColor( rFieldTextColor ); + Point aTL( (aLogSize.Width() - m_aFrmSize.Width()) / 2, + (aLogSize.Height() - m_aFrmSize.Height()) / 2); + Rectangle aRect(aTL, m_aFrmSize); + + //draw a shadow rectangle + SetFillColor( Color(COL_GRAY) ); + Rectangle aShadowRect(aRect); + aShadowRect.Move(aTL.Y(), aTL.Y()); + DrawRect(aShadowRect); + + SetFillColor( rFieldColor ); + DrawRect(aRect); + + SetFillColor( aGrayColor ); + + //Spaltentrenner? + long nLength = aLogSize.Height() - 2 * aTL.Y(); + Point aUp( aTL ); + Point aDown( aTL.X(), nLength ); + sal_Bool bLines = sal_False; + if(m_aCols.GetLineAdj() != COLADJ_NONE) + { + bLines = sal_True; + + sal_uInt16 nPercent = m_aCols.GetLineHeight(); + if( nPercent != 100 ) + { + nLength -= nLength * nPercent / 100; + switch(m_aCols.GetLineAdj()) + { + case COLADJ_BOTTOM: aUp.Y() += nLength; break; + case COLADJ_TOP: aDown.Y() -= nLength; break; + case COLADJ_CENTER: + aUp.Y() += nLength / 2; + aDown.Y() -= nLength / 2; + break; + default:; //prevent warning + } + } + + } + const SwColumns& rCols = m_aCols.GetColumns(); + sal_uInt16 nColCount = rCols.Count(); + if( nColCount ) + { + DrawRect(aRect); + SetFillColor( rFieldColor ); + Rectangle aFrmRect(aTL, m_aFrmSize); + long nSum = aTL.X(); + for(sal_uInt16 i = 0; i < nColCount; i++) + { + SwColumn* pCol = rCols[i]; + aFrmRect.Left() = nSum + pCol->GetLeft();//nSum + pCol->GetLeft() + aTL.X(); + nSum += pCol->GetWishWidth(); + aFrmRect.Right() = nSum - pCol->GetRight(); + DrawRect(aFrmRect); + } + if(bLines ) + { + nSum = aTL.X(); + for(sal_uInt16 i = 0; i < nColCount - 1; i++) + { + nSum += rCols[i]->GetWishWidth(); + aUp.X() = nSum; + aDown.X() = nSum; + DrawLine(aUp, aDown); + } + } + } +} + +/*-----------------25.10.96 12.05------------------- + +--------------------------------------------------*/ + + +void SwColumnOnlyExample::SetColumns(const SwFmtCol& rCol) +{ + m_aCols = rCol; + sal_uInt16 nWishSum = m_aCols.GetWishWidth(); + long nFrmWidth = m_aFrmSize.Width(); + SwColumns& rCols = m_aCols.GetColumns(); + sal_uInt16 nColCount = rCols.Count(); + + for(sal_uInt16 i = 0; i < nColCount; i++) + { + SwColumn* pCol = rCols[i]; + long nWish = pCol->GetWishWidth(); + nWish *= nFrmWidth; + nWish /= nWishSum; + pCol->SetWishWidth((sal_uInt16)nWish); + long nLeft = pCol->GetLeft(); + nLeft *= nFrmWidth; + nLeft /= nWishSum; + pCol->SetLeft((sal_uInt16)nLeft); + long nRight = pCol->GetRight(); + nRight *= nFrmWidth; + nRight /= nWishSum; + pCol->SetRight((sal_uInt16)nRight); + } + // #97495# make sure that the automatic column width's are always equal + if(nColCount && m_aCols.IsOrtho()) + { + sal_Int32 nColumnWidthSum = 0; + sal_uInt16 i; + for(i = 0; i < nColCount; ++i) + { + SwColumn* pCol = rCols[i]; + nColumnWidthSum += pCol->GetWishWidth(); + nColumnWidthSum -= (pCol->GetRight() + pCol->GetLeft()); + } + nColumnWidthSum /= nColCount; + for(i = 0; i < nColCount; ++i) + { + SwColumn* pCol = rCols[i]; + pCol->SetWishWidth( static_cast< sal_uInt16 >(nColumnWidthSum + pCol->GetRight() + pCol->GetLeft())); + } + } +} +/* -----------------------------08.02.2002 11:44------------------------------ + + ---------------------------------------------------------------------------*/ +SwPageGridExample::~SwPageGridExample() +{ + delete pGridItem; +} +/* -----------------------------08.02.2002 11:48------------------------------ + + ---------------------------------------------------------------------------*/ +#define MAX_ROWS 10 +#define MAX_LINES 15 +void SwPageGridExample::DrawPage( const Point& rOrg, + const sal_Bool bSecond, + const sal_Bool bEnabled ) +{ + SwPageExample::DrawPage(rOrg, bSecond, bEnabled); + if(pGridItem && pGridItem->GetGridType()) + { + //paint the grid now + Color aLineColor = pGridItem->GetColor(); + if(aLineColor.GetColor() == COL_AUTO) + { + aLineColor = GetFillColor(); + aLineColor.Invert(); + } + SetLineColor(aLineColor); + long nL = GetLeft(); + long nR = GetRight(); + + if ( GetUsage() == SVX_PAGE_MIRROR && !bSecond ) + { + // fuer gespiegelt drehen + nL = GetRight(); + nR = GetLeft(); + } + + Rectangle aRect; + aRect.Right() = rOrg.X() + GetSize().Width() - nR; + aRect.Left() = rOrg.X() + nL; + aRect.Top() = rOrg.Y() + GetTop() + + GetHdHeight() + GetHdDist(); + aRect.Bottom()= rOrg.Y() + GetSize().Height() - GetBottom() + - GetFtHeight() - GetFtDist(); + + //increase the values to get a 'viewable' preview + sal_Int32 nBaseHeight = pGridItem->GetBaseHeight() * 3; + sal_Int32 nRubyHeight = pGridItem->GetRubyHeight() * 3; + + //detect height of rectangles + Rectangle aRubyRect(aRect.TopLeft(), + m_bVertical ? + Size(nRubyHeight, aRect.GetHeight()) : + Size(aRect.GetWidth(), nRubyHeight)); + Rectangle aCharRect(aRect.TopLeft(), + m_bVertical ? + Size(nBaseHeight, aRect.GetHeight()) : + Size(aRect.GetWidth(), nBaseHeight)); + + sal_Int32 nLineHeight = nBaseHeight + nRubyHeight; + + //detect count of rectangles + sal_Int32 nLines = (m_bVertical ? aRect.GetWidth(): aRect.GetHeight()) / nLineHeight; + if(nLines > pGridItem->GetLines()) + nLines = pGridItem->GetLines(); + + // determine start position + if(m_bVertical) + { + sal_Int16 nXStart = static_cast< sal_Int16 >(aRect.GetWidth() / 2 - nLineHeight * nLines /2); + aRubyRect.Move(nXStart, 0); + aCharRect.Move(nXStart, 0); + } + else + { + sal_Int16 nYStart = static_cast< sal_Int16 >(aRect.GetHeight() / 2 - nLineHeight * nLines /2); + aRubyRect.Move(0, nYStart); + aCharRect.Move(0, nYStart); + } + + if(pGridItem->IsRubyTextBelow()) + m_bVertical ? aRubyRect.Move(nBaseHeight, 0) : aRubyRect.Move(0, nBaseHeight); + else + m_bVertical ? aCharRect.Move(nRubyHeight, 0) : aCharRect.Move(0, nRubyHeight); + + //vertical lines + sal_Bool bBothLines = pGridItem->GetGridType() == GRID_LINES_CHARS; + SetFillColor( Color( COL_TRANSPARENT ) ); + sal_Int32 nXMove = m_bVertical ? nLineHeight : 0; + sal_Int32 nYMove = m_bVertical ? 0 : nLineHeight; + for(sal_Int32 nLine = 0; nLine < nLines; nLine++) + { + DrawRect(aRubyRect); + DrawRect(aCharRect); + if(bBothLines) + { + Point aStart = aCharRect.TopLeft(); + Point aEnd = m_bVertical ? aCharRect.TopRight() : aCharRect.BottomLeft(); + while(m_bVertical ? aStart.Y() < aRect.Bottom(): aStart.X() < aRect.Right()) + { + DrawLine(aStart, aEnd); + if(m_bVertical) + aStart.Y() = aEnd.Y() += nBaseHeight; + else + aStart.X() = aEnd.X() += nBaseHeight; + } + } + aRubyRect.Move(nXMove, nYMove); + aCharRect.Move(nXMove, nYMove); + } + } +} +/* -----------------------------08.02.2002 11:48------------------------------ + + ---------------------------------------------------------------------------*/ +void SwPageGridExample::UpdateExample( const SfxItemSet& rSet ) +{ + DELETEZ(pGridItem); + //get the grid information + if(SFX_ITEM_AVAILABLE <= rSet.GetItemState(RES_TEXTGRID, sal_True)) + pGridItem = (SwTextGridItem*)((const SwTextGridItem&)rSet.Get(RES_TEXTGRID)).Clone(); + if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( RES_FRAMEDIR, sal_True )) + { + const SvxFrameDirectionItem& rDirItem = + (const SvxFrameDirectionItem&)rSet.Get(RES_FRAMEDIR); + m_bVertical = rDirItem.GetValue() == FRMDIR_VERT_TOP_RIGHT|| + rDirItem.GetValue() == FRMDIR_VERT_TOP_LEFT; + } + SwPageExample::UpdateExample(rSet); +} + diff --git a/sw/source/ui/frmdlg/colmgr.cxx b/sw/source/ui/frmdlg/colmgr.cxx new file mode 100644 index 000000000000..90f695aa8ae5 --- /dev/null +++ b/sw/source/ui/frmdlg/colmgr.cxx @@ -0,0 +1,191 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + + + +#include "hintids.hxx" +#include <editeng/lrspitem.hxx> + +#include "frmmgr.hxx" +#include "frmfmt.hxx" +#include "colmgr.hxx" + + +// PRIVATE METHODES ------------------------------------------------------ +/*------------------------------------------------------------------------ + Beschreibung: Spaltenbreite auf aktuelle Breite einstellen +------------------------------------------------------------------------*/ + + + +void FitToActualSize(SwFmtCol& rCol, sal_uInt16 nWidth) +{ + const sal_uInt16 nCount = rCol.GetColumns().Count(); + for(sal_uInt16 i = 0; i < nCount; ++i) + { + const sal_uInt16 nTmp = rCol.CalcColWidth(i, nWidth); + rCol.GetColumns()[i]->SetWishWidth(nTmp); + } + rCol.SetWishWidth(nWidth); +} + + +// PUBLIC METHODES ------------------------------------------------------- +/*------------------------------------------------------------------------ + Beschreibung: Setzen Spaltenanzahl und Gutterwidth +------------------------------------------------------------------------*/ + + + +void SwColMgr::SetCount(sal_uInt16 nCount, sal_uInt16 nGutterWidth) +{ + aFmtCol.Init(nCount, nGutterWidth, nWidth); + aFmtCol.SetWishWidth(nWidth); + aFmtCol.SetGutterWidth(nGutterWidth, nWidth); +} + + + +sal_uInt16 SwColMgr::GetGutterWidth( sal_uInt16 nPos ) const +{ + sal_uInt16 nRet; + if(nPos == USHRT_MAX ) + nRet = GetCount() > 1 ? aFmtCol.GetGutterWidth() : DEF_GUTTER_WIDTH; + else + { + DBG_ASSERT(nPos < GetCount() - 1, "Spalte ueberindiziert" ); + const SwColumns& rCols = aFmtCol.GetColumns(); + nRet = rCols.GetObject(nPos)->GetRight() + rCols.GetObject(nPos + 1)->GetLeft(); + } + return nRet; +} + +/*-----------------22.10.96 14.28------------------- + +--------------------------------------------------*/ + + +void SwColMgr::SetGutterWidth(sal_uInt16 nGutterWidth, sal_uInt16 nPos ) +{ + if(nPos == USHRT_MAX) + aFmtCol.SetGutterWidth(nGutterWidth, nWidth); + else + { + DBG_ASSERT(nPos < GetCount() - 1, "Spalte ueberindiziert" ); + SwColumns& rCols = aFmtCol.GetColumns(); + sal_uInt16 nGutterWidth2 = nGutterWidth / 2; + rCols.GetObject(nPos)->SetRight(nGutterWidth2); + rCols.GetObject(nPos + 1)->SetLeft(nGutterWidth2); + } +} + +/*------------------------------------------------------------------------ + Beschreibung: Hoehe Trennlinie +------------------------------------------------------------------------*/ + + + +short SwColMgr::GetLineHeightPercent() const +{ + return (short)aFmtCol.GetLineHeight(); +} + + + +void SwColMgr::SetLineHeightPercent(short nPercent) +{ + ASSERT(nPercent <= 100, LineHeight darf nur bis 100 % gross sein); + aFmtCol.SetLineHeight((sal_uInt8)nPercent); +} +/*------------------------------------------------------------------------ + Beschreibung: Spaltenbreite +------------------------------------------------------------------------*/ + + + +sal_uInt16 SwColMgr::GetColWidth(sal_uInt16 nIdx) const +{ + ASSERT(nIdx < GetCount(), Spaltenarray ueberindiziert.); + return aFmtCol.CalcPrtColWidth(nIdx, nWidth); +} + + + +void SwColMgr::SetColWidth(sal_uInt16 nIdx, sal_uInt16 nWd) +{ + ASSERT(nIdx < GetCount(), Spaltenarray ueberindiziert.); + aFmtCol.GetColumns()[nIdx]->SetWishWidth(nWd); + +} + +/*-------------------------------------------------------------------- + Beschreibung: Groesse neu setzen + --------------------------------------------------------------------*/ + + + +void SwColMgr::SetActualWidth(sal_uInt16 nW) +{ + nWidth = nW; + ::FitToActualSize(aFmtCol, nW); +} + +/*-------------------------------------------------------------------- + Beschreibung: ctor + --------------------------------------------------------------------*/ + + + +SwColMgr::SwColMgr(const SfxItemSet& rSet, sal_uInt16 nActWidth) : + aFmtCol((const SwFmtCol&)rSet.Get(RES_COL)), + nWidth(nActWidth) +{ + if(nWidth == USHRT_MAX) + { + nWidth = (sal_uInt16)((const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE)).GetWidth(); + if (nWidth < MINLAY) + nWidth = USHRT_MAX; + const SvxLRSpaceItem &rLR = (const SvxLRSpaceItem&)rSet.Get(RES_LR_SPACE); + nWidth = nWidth - (sal_uInt16)rLR.GetLeft(); + nWidth = nWidth - (sal_uInt16)rLR.GetRight(); + } + ::FitToActualSize(aFmtCol, nWidth); +} + + + + +SwColMgr::~SwColMgr() {} + + + + + + diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx new file mode 100644 index 000000000000..9859f4875b46 --- /dev/null +++ b/sw/source/ui/frmdlg/column.cxx @@ -0,0 +1,1498 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + +#include "column.hxx" + +#include "hintids.hxx" +#include <svx/htmlmode.hxx> +#include <editeng/borderline.hxx> +#include <editeng/boxitem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/sizeitem.hxx> +#include "editeng/frmdiritem.hxx" +#include <svl/ctloptions.hxx> +#include <sfx2/dispatch.hxx> +#include <vcl/msgbox.hxx> +#include <swmodule.hxx> + +#include <helpid.h> +#include "globals.hrc" +#include "swtypes.hxx" +#include "wrtsh.hxx" +#include "view.hxx" +#include "docsh.hxx" +#include "uitool.hxx" +#include "cmdid.h" +#include "viewopt.hxx" +#include "format.hxx" +#include "frmmgr.hxx" +#include "frmdlg.hxx" +#include "colmgr.hxx" +#include "prcntfld.hxx" +#include "paratr.hxx" +#include "frmui.hrc" +#include "poolfmt.hrc" +#include "column.hrc" +#include <section.hxx> +#include <docary.hxx> +#include <pagedesc.hxx> + +#include "access.hrc" + +#define FRAME_FORMAT_WIDTH 1000 + +// sw/inc/fmtclds.hxx +SV_IMPL_PTRARR( SwColumns, SwColumnPtr ) + +/*-------------------------------------------------------------------- + Beschreibung: Statische Daten + --------------------------------------------------------------------*/ + +static const sal_uInt16 __FAR_DATA nLines[] = { + DEF_LINE_WIDTH_0, + DEF_LINE_WIDTH_1, + DEF_LINE_WIDTH_2, + DEF_LINE_WIDTH_3, + DEF_LINE_WIDTH_4 +}; + +static const sal_uInt16 nLineCount = sizeof(nLines) / sizeof(nLines[0]); +static const sal_uInt16 nVisCols = 3; + +inline sal_Bool IsMarkInSameSection( SwWrtShell& rWrtSh, const SwSection* pSect ) +{ + rWrtSh.SwapPam(); + sal_Bool bRet = pSect == rWrtSh.GetCurrSection(); + rWrtSh.SwapPam(); + return bRet; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +SwColumnDlg::SwColumnDlg(Window* pParent, SwWrtShell& rSh) : + SfxModalDialog(pParent, SW_RES(DLG_COLUMN)), + aOK(this, SW_RES(PB_OK)), + aCancel(this, SW_RES(PB_CANCEL)), + aHelp(this, SW_RES(PB_HELP)), + aApplyToFT(this, SW_RES(FT_APPLY_TO)), + aApplyToLB(this, SW_RES(LB_APPLY_TO)), + rWrtShell(rSh), + pPageSet(0), + pSectionSet(0), + pSelectionSet(0), + pFrameSet(0), + nOldSelection(0), + nSelectionWidth(0), + bPageChanged(sal_False), + bSectionChanged(sal_False), + bSelSectionChanged(sal_False), + bFrameChanged(sal_False) +{ + FreeResource(); + + SwRect aRect; + rWrtShell.CalcBoundRect(aRect, FLY_AS_CHAR); + + nSelectionWidth = aRect.Width(); + + SfxItemSet* pColPgSet = 0; + static sal_uInt16 __READONLY_DATA aSectIds[] = { RES_COL, RES_COL, + RES_FRM_SIZE, RES_FRM_SIZE, + RES_COLUMNBALANCE, RES_FRAMEDIR, + 0 }; + + const SwSection* pCurrSection = rWrtShell.GetCurrSection(); + sal_uInt16 nFullSectCnt = rWrtShell.GetFullSelectedSectionCount(); + if( pCurrSection && ( !rWrtShell.HasSelection() || 0 != nFullSectCnt )) + { + nSelectionWidth = rSh.GetSectionWidth(*pCurrSection->GetFmt()); + if ( !nSelectionWidth ) + nSelectionWidth = USHRT_MAX; + pSectionSet = new SfxItemSet( rWrtShell.GetAttrPool(), aSectIds ); + pSectionSet->Put( pCurrSection->GetFmt()->GetAttrSet() ); + pColPgSet = pSectionSet; + aApplyToLB.RemoveEntry( aApplyToLB.GetEntryPos( + (void*)( 1 >= nFullSectCnt + ? LISTBOX_SECTIONS + : LISTBOX_SECTION ))); + } + else + { + aApplyToLB.RemoveEntry(aApplyToLB.GetEntryPos( (void*) LISTBOX_SECTION )); + aApplyToLB.RemoveEntry(aApplyToLB.GetEntryPos( (void*) LISTBOX_SECTIONS )); + } + + if( rWrtShell.HasSelection() && rWrtShell.IsInsRegionAvailable() && + ( !pCurrSection || ( 1 != nFullSectCnt && + IsMarkInSameSection( rWrtShell, pCurrSection ) ))) + { + pSelectionSet = new SfxItemSet( rWrtShell.GetAttrPool(), aSectIds ); + pColPgSet = pSelectionSet; + } + else + aApplyToLB.RemoveEntry(aApplyToLB.GetEntryPos( (void*) LISTBOX_SELECTION )); + + if( rWrtShell.GetFlyFrmFmt() ) + { + const SwFrmFmt* pFmt = rSh.GetFlyFrmFmt() ; + pFrameSet = new SfxItemSet(rWrtShell.GetAttrPool(), aSectIds ); + pFrameSet->Put(pFmt->GetFrmSize()); + pFrameSet->Put(pFmt->GetCol()); + pColPgSet = pFrameSet; + } + else + aApplyToLB.RemoveEntry(aApplyToLB.GetEntryPos( (void*) LISTBOX_FRAME )); + + + sal_uInt16 nPagePos = aApplyToLB.GetEntryPos( (void*) LISTBOX_PAGE ); + const SwPageDesc* pPageDesc = rWrtShell.GetSelectedPageDescs(); + if( pPageDesc ) + { + pPageSet = new SfxItemSet( rWrtShell.GetAttrPool(), + RES_COL, RES_COL, + RES_FRM_SIZE, RES_FRM_SIZE, + RES_LR_SPACE, RES_LR_SPACE, + 0 ); + + String sPageStr = aApplyToLB.GetEntry(nPagePos); + aApplyToLB.RemoveEntry( nPagePos ); + sPageStr += pPageDesc->GetName(); + aApplyToLB.InsertEntry( sPageStr, nPagePos ); + aApplyToLB.SetEntryData( nPagePos, (void*) LISTBOX_PAGE); + + const SwFrmFmt &rFmt = pPageDesc->GetMaster(); + nPageWidth = rFmt.GetFrmSize().GetSize().Width(); + + const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&)rFmt.GetLRSpace(); + const SvxBoxItem& rBox = (const SvxBoxItem&) rFmt.GetBox(); + nPageWidth -= rLRSpace.GetLeft() + rLRSpace.GetRight() + rBox.GetDistance(); + + pPageSet->Put(rFmt.GetCol()); + pPageSet->Put(rFmt.GetLRSpace()); + pColPgSet = pPageSet; + } + else + aApplyToLB.RemoveEntry( nPagePos ); + + + ASSERT( pColPgSet, "" ); + // TabPage erzeugen + SwColumnPage* pPage = (SwColumnPage*) SwColumnPage::Create( this, + *pColPgSet ); + pTabPage = pPage; + + //Groesse anpassen + Size aPageSize(pTabPage->GetSizePixel()); + Size aDlgSize(GetOutputSizePixel()); + aDlgSize.Height() = aPageSize.Height(); + SetOutputSizePixel(aDlgSize); + pTabPage->Show(); + + aApplyToLB.SelectEntryPos(0); + ObjectHdl(0); + + aApplyToLB.SetSelectHdl(LINK(this, SwColumnDlg, ObjectHdl)); + aOK.SetClickHdl(LINK(this, SwColumnDlg, OkHdl)); + //#i80458# if no columns can be set then disable OK + if( !aApplyToLB.GetEntryCount() ) + aOK.Enable( sal_False ); + //#i97810# set focus to the TabPage + pTabPage->ActivateColumnControl(); +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +SwColumnDlg::~SwColumnDlg() +{ + delete pTabPage; + delete pPageSet; + delete pSectionSet; + delete pSelectionSet; +} + +/* -----------------26.05.99 11:40------------------- + * + * --------------------------------------------------*/ +IMPL_LINK(SwColumnDlg, ObjectHdl, ListBox*, pBox) +{ + SfxItemSet* pSet = 0; + switch(nOldSelection) + { + case LISTBOX_SELECTION : + pSet = pSelectionSet; + break; + case LISTBOX_SECTION : + pSet = pSectionSet; + bSectionChanged = sal_True; + break; + case LISTBOX_SECTIONS : + pSet = pSectionSet; + bSelSectionChanged = sal_True; + break; + case LISTBOX_PAGE : + pSet = pPageSet; + bPageChanged = sal_True; + break; + case LISTBOX_FRAME: + pSet = pFrameSet; + bFrameChanged = sal_True; + break; + } + if(pBox) + { + pTabPage->FillItemSet(*pSet); + } + nOldSelection = (long)aApplyToLB.GetEntryData(aApplyToLB.GetSelectEntryPos()); + long nWidth = nSelectionWidth; + switch(nOldSelection) + { + case LISTBOX_SELECTION : + pSet = pSelectionSet; + if( pSelectionSet ) + pSet->Put(SwFmtFrmSize(ATT_VAR_SIZE, nWidth, nWidth)); + break; + case LISTBOX_SECTION : + case LISTBOX_SECTIONS : + pSet = pSectionSet; + pSet->Put(SwFmtFrmSize(ATT_VAR_SIZE, nWidth, nWidth)); + break; + case LISTBOX_PAGE : + nWidth = nPageWidth; + pSet = pPageSet; + pSet->Put(SwFmtFrmSize(ATT_VAR_SIZE, nWidth, nWidth)); + break; + case LISTBOX_FRAME: + pSet = pFrameSet; + break; + } + + sal_Bool bIsSection = pSet == pSectionSet || pSet == pSelectionSet; + pTabPage->ShowBalance(bIsSection); + pTabPage->SetInSection(bIsSection); + pTabPage->SetFrmMode(sal_True); + pTabPage->SetPageWidth(nWidth); + if( pSet ) + pTabPage->Reset(*pSet); + return 0; +} +/* -----------------26.05.99 12:32------------------- + * + * --------------------------------------------------*/ +IMPL_LINK(SwColumnDlg, OkHdl, OKButton*, EMPTYARG) +{ + //aktuelle Selektion auswerten + SfxItemSet* pSet = 0; + switch(nOldSelection) + { + case LISTBOX_SELECTION : + pSet = pSelectionSet; + break; + case LISTBOX_SECTION : + pSet = pSectionSet; + bSectionChanged = sal_True; + break; + case LISTBOX_SECTIONS : + pSet = pSectionSet; + bSelSectionChanged = sal_True; + break; + case LISTBOX_PAGE : + pSet = pPageSet; + bPageChanged = sal_True; + break; + case LISTBOX_FRAME: + pSet = pFrameSet; + bFrameChanged = sal_True; + break; + } + pTabPage->FillItemSet(*pSet); + + if(pSelectionSet && SFX_ITEM_SET == pSelectionSet->GetItemState(RES_COL)) + { + //Bereich mit Spalten einfuegen + const SwFmtCol& rColItem = (const SwFmtCol&)pSelectionSet->Get(RES_COL); + //nur, wenn es auch Spalten gibt! + if(rColItem.GetNumCols() > 1) + rWrtShell.GetView().GetViewFrame()->GetDispatcher()->Execute( + FN_INSERT_REGION, SFX_CALLMODE_ASYNCHRON, *pSelectionSet ); + } + + if(pSectionSet && pSectionSet->Count() && bSectionChanged ) + { + const SwSection* pCurrSection = rWrtShell.GetCurrSection(); + const SwSectionFmt* pFmt = pCurrSection->GetFmt(); + sal_uInt16 nNewPos = rWrtShell.GetSectionFmtPos( *pFmt ); + SwSectionData aData(*pCurrSection); + rWrtShell.UpdateSection( nNewPos, aData, pSectionSet ); + } + + if(pSectionSet && pSectionSet->Count() && bSelSectionChanged ) + { + rWrtShell.SetSectionAttr( *pSectionSet ); + } + + if(pPageSet && SFX_ITEM_SET == pPageSet->GetItemState(RES_COL) && bPageChanged) + { + // aktuellen PageDescriptor ermitteln und damit den Set fuellen + const sal_uInt16 nCurIdx = rWrtShell.GetCurPageDesc(); + SwPageDesc aPageDesc(rWrtShell.GetPageDesc(nCurIdx)); + SwFrmFmt &rFmt = aPageDesc.GetMaster(); + rFmt.SetFmtAttr(pPageSet->Get(RES_COL)); + rWrtShell.ChgPageDesc(nCurIdx, aPageDesc); + } + if(pFrameSet && SFX_ITEM_SET == pFrameSet->GetItemState(RES_COL) && bFrameChanged) + { + SfxItemSet aTmp(*pFrameSet->GetPool(), RES_COL, RES_COL); + aTmp.Put(*pFrameSet); + rWrtShell.StartAction(); + rWrtShell.Push(); + rWrtShell.SetFlyFrmAttr( aTmp ); + //die Rahmenselektion wieder aufheben + if(rWrtShell.IsFrmSelected()) + { + rWrtShell.UnSelectFrm(); + rWrtShell.LeaveSelFrmMode(); + } + rWrtShell.Pop(); + rWrtShell.EndAction(); + } + EndDialog(RET_OK); + return 0; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +#if OSL_DEBUG_LEVEL < 2 +inline +#endif +sal_uInt16 GetMaxWidth( SwColMgr* pColMgr, sal_uInt16 nCols ) +{ + sal_uInt16 nMax = pColMgr->GetActualSize(); + if( --nCols ) + nMax -= pColMgr->GetGutterWidth() * nCols; + return nMax; +} + +static sal_uInt16 __FAR_DATA aPageRg[] = { + RES_COL, RES_COL, + 0 +}; + + +DBG_NAME(columnhdl) + + + +sal_uInt16 lcl_LineWidthToPos(sal_uLong nWidth) +{ + const sal_uInt16 nUShortWidth = (sal_uInt16)nWidth; + for(sal_uInt16 i = 0; i < nLineCount; ++i) + if(nUShortWidth == nLines[i]) + return i; + return 0; +} + + + +void SwColumnPage::ResetColWidth() +{ + if( nCols ) + { + sal_uInt16 nWidth = GetMaxWidth( pColMgr, nCols ); + nWidth = nWidth / nCols; + + for(sal_uInt16 i = 0; i < nCols; ++i) + nColWidth[i] = (long) nWidth; + } + +} + +/*-------------------------------------------------------------------- + Beschreibung: Jetzt als TabPage + --------------------------------------------------------------------*/ + + + +SwColumnPage::SwColumnPage(Window *pParent, const SfxItemSet &rSet) + + : SfxTabPage(pParent, SW_RES(TP_COLUMN), rSet), + + aFLGroup(this, SW_RES(FL_COLUMNS )), + aClNrLbl(this, SW_RES(FT_NUMBER )), + aCLNrEdt(this, SW_RES(ED_NUMBER )), + aDefaultVS(this, SW_RES(VS_DEFAULTS)), + aBalanceColsCB(this, SW_RES(CB_BALANCECOLS)), + + aFLLayout(this, SW_RES(FL_LAYOUT)), + aBtnUp(this, SW_RES(BTN_DOWN)), + aColumnFT(this, SW_RES(FT_COLUMN)), + aWidthFT(this, SW_RES(FT_WIDTH)), + aDistFT(this, SW_RES(FT_DIST)), + aLbl1(this, SW_RES(FT_1)), + aEd1(this, SW_RES(ED_1)), + aDistEd1(this, SW_RES(ED_DIST1)), + aLbl2(this, SW_RES(FT_2)), + aEd2(this, SW_RES(ED_2)), + aDistEd2(this, SW_RES(ED_DIST2)), + aLbl3(this, SW_RES(FT_3)), + aEd3(this, SW_RES(ED_3)), + aBtnDown(this, SW_RES(BTN_UP)), + aAutoWidthBox(this, SW_RES(CB_AUTO_WIDTH)), + + aFLLineType(this, SW_RES(FL_LINETYPE)), + aLineTypeLbl(this, SW_RES(FT_STYLE)), + aLineTypeDLB(this, SW_RES(LB_STYLE)), + aLineHeightLbl(this, SW_RES(FT_HEIGHT)), + aLineHeightEdit(this, SW_RES(ED_HEIGHT)), + aLinePosLbl(this, SW_RES(FT_POSITION)), + aLinePosDLB(this, SW_RES(LB_POSITION)), + + aVertFL(this, SW_RES(FL_VERT)), + aPropertiesFL( this, SW_RES( FL_PROPERTIES )), + aTextDirectionFT( this, SW_RES( FT_TEXTDIRECTION )), + aTextDirectionLB( this, SW_RES( LB_TEXTDIRECTION )), + + aPgeExampleWN(this, SW_RES(WN_BSP)), + aFrmExampleWN(this, SW_RES(WN_BSP)), + + pColMgr(0), + + nFirstVis(0), + nMinWidth(MINLAY), + pModifiedField(0), + bFormat(sal_False), + bFrm(sal_False), + bHtmlMode(sal_False), + bLockUpdate(sal_False) +{ + sal_uInt16 i; + + FreeResource(); + SetExchangeSupport(); + + aBtnDown.SetAccessibleRelationMemberOf(&aFLLayout); + aEd1.SetAccessibleRelationLabeledBy(&aWidthFT); + aEd2.SetAccessibleRelationLabeledBy(&aWidthFT); + aEd3.SetAccessibleRelationLabeledBy(&aWidthFT); + aDistEd1.SetAccessibleRelationLabeledBy(&aDistFT); + aDistEd2.SetAccessibleRelationLabeledBy(&aDistFT); + aBtnUp.SetAccessibleRelationLabeledBy(&aColumnFT); + aBtnDown.SetAccessibleRelationLabeledBy(&aColumnFT); + + aDefaultVS.SetHelpId(HID_COLUMN_VALUESET); + aDefaultVS.SetColCount( 5 ); + aDefaultVS.SetStyle( aDefaultVS.GetStyle() + | WB_ITEMBORDER + | WB_DOUBLEBORDER ); + + for( i = 0; i < 5; i++) + aDefaultVS.InsertItem( i + 1, i ); + + aDefaultVS.SetSelectHdl(LINK(this, SwColumnPage, SetDefaultsHdl)); + + // Controls fuer Zusaetzebereich beim MoreButton anmelden + Link aCLNrLk = LINK(this, SwColumnPage, ColModify); + aCLNrEdt.SetLoseFocusHdl(aCLNrLk); + aCLNrEdt.SetUpHdl(aCLNrLk); + aCLNrEdt.SetDownHdl(aCLNrLk); + Link aLk = LINK(this, SwColumnPage, GapModify); + aDistEd1.SetUpHdl(aLk); + aDistEd1.SetDownHdl(aLk); + aDistEd1.SetLoseFocusHdl(aLk); + aDistEd2.SetUpHdl(aLk); + aDistEd2.SetDownHdl(aLk); + aDistEd2.SetLoseFocusHdl(aLk); + + aLk = LINK(this, SwColumnPage, EdModify); + + aEd1.SetUpHdl(aLk); + aEd1.SetDownHdl(aLk); + aEd1.SetLoseFocusHdl(aLk); + + aEd2.SetUpHdl(aLk); + aEd2.SetDownHdl(aLk); + aEd2.SetLoseFocusHdl(aLk); + + aEd3.SetUpHdl(aLk); + aEd3.SetDownHdl(aLk); + aEd3.SetLoseFocusHdl(aLk); + + aBtnUp.SetClickHdl(LINK(this, SwColumnPage, Up)); + aBtnDown.SetClickHdl(LINK(this, SwColumnPage, Down)); + aAutoWidthBox.SetClickHdl(LINK(this, SwColumnPage, AutoWidthHdl)); + + aLk = LINK( this, SwColumnPage, UpdateColMgr ); + aLineTypeDLB.SetSelectHdl( aLk ); + aLineHeightEdit.SetModifyHdl( aLk ); + aLinePosDLB.SetSelectHdl( aLk ); + + // Trennlinie + aLineTypeDLB.SetUnit( FUNIT_POINT ); + aLineTypeDLB.SetSourceUnit( FUNIT_TWIP ); + for( i = 0; i < nLineCount; ++i ) + aLineTypeDLB.InsertEntry( 100 * nLines[ i ] ); +} + + + +SwColumnPage::~SwColumnPage() +{ + delete pColMgr; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + + +void SwColumnPage::SetPageWidth(long nPageWidth) +{ + long nNewMaxWidth = static_cast< long >(aEd1.NormalizePercent(nPageWidth)); + + aDistEd1.SetMax(nNewMaxWidth, FUNIT_TWIP); + aDistEd2.SetMax(nNewMaxWidth, FUNIT_TWIP); + aEd1.SetMax(nNewMaxWidth, FUNIT_TWIP); + aEd2.SetMax(nNewMaxWidth, FUNIT_TWIP); + aEd3.SetMax(nNewMaxWidth, FUNIT_TWIP); +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + + + +void SwColumnPage::Reset(const SfxItemSet &rSet) +{ + sal_uInt16 nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current()); + if(nHtmlMode & HTMLMODE_ON) + { + bHtmlMode = sal_True; + aAutoWidthBox.Enable(sal_False); + } + FieldUnit aMetric = ::GetDfltMetric(bHtmlMode); + SetMetric(aEd1, aMetric); + SetMetric(aEd2, aMetric); + SetMetric(aEd3, aMetric); + SetMetric(aDistEd1, aMetric); + SetMetric(aDistEd2, aMetric); + + delete pColMgr; + pColMgr = new SwColMgr(rSet); + nCols = pColMgr->GetCount() ; + aCLNrEdt.SetMax(Max((sal_uInt16)aCLNrEdt.GetMax(), (sal_uInt16)nCols)); + aCLNrEdt.SetLast(Max(nCols,(sal_uInt16)aCLNrEdt.GetMax())); + + if(bFrm) + { + if(bFormat) // hier gibt es keine Size + pColMgr->SetActualWidth(FRAME_FORMAT_WIDTH); + else + { + const SwFmtFrmSize& rSize = (const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE); + const SvxBoxItem& rBox = (const SvxBoxItem&) rSet.Get(RES_BOX); + pColMgr->SetActualWidth((sal_uInt16)rSize.GetSize().Width() - rBox.GetDistance()); + } + } + if(aBalanceColsCB.IsVisible()) + { + const SfxPoolItem* pItem; + if( SFX_ITEM_SET == rSet.GetItemState( RES_COLUMNBALANCE, sal_False, &pItem )) + aBalanceColsCB.Check(!((const SwFmtNoBalancedColumns*)pItem)->GetValue()); + else + aBalanceColsCB.Check( sal_True ); + } + + //text direction + if( SFX_ITEM_AVAILABLE <= rSet.GetItemState( RES_FRAMEDIR ) ) + { + const SvxFrameDirectionItem& rItem = (const SvxFrameDirectionItem&)rSet.Get(RES_FRAMEDIR); + sal_uInt32 nVal = rItem.GetValue(); + sal_uInt16 nPos = aTextDirectionLB.GetEntryPos( (void*) nVal ); + aTextDirectionLB.SelectEntryPos( nPos ); + aTextDirectionLB.SaveValue(); + } + + Init(); + ActivatePage( rSet ); +} + +/*-------------------------------------------------------------------- + Beschreibung: TabPage erzeugen + --------------------------------------------------------------------*/ + + + +SfxTabPage* SwColumnPage::Create(Window *pParent, const SfxItemSet &rSet) +{ + return new SwColumnPage(pParent, rSet); +} + +/*-------------------------------------------------------------------- + Beschreibung: Attribute in den Set stopfen bei OK + --------------------------------------------------------------------*/ + + + +sal_Bool SwColumnPage::FillItemSet(SfxItemSet &rSet) +{ + if(aCLNrEdt.HasChildPathFocus()) + aCLNrEdt.GetDownHdl().Call(&aCLNrEdt); + // Im ItemSet setzen + // Die aktuellen Einstellungen sind + // schon vorhanden + // + const SfxPoolItem* pOldItem; + const SwFmtCol& rCol = pColMgr->GetColumns(); + if(0 == (pOldItem = GetOldItem( rSet, RES_COL )) || + rCol != *pOldItem ) + rSet.Put(rCol); + + if(aBalanceColsCB.IsVisible() ) + { + rSet.Put(SwFmtNoBalancedColumns(!aBalanceColsCB.IsChecked() )); + } + sal_uInt16 nPos; + if( aTextDirectionLB.IsVisible() && + ( nPos = aTextDirectionLB.GetSelectEntryPos() ) != + aTextDirectionLB.GetSavedValue() ) + { + sal_uInt32 nDirection = (sal_uInt32)(sal_IntPtr)aTextDirectionLB.GetEntryData( nPos ); + rSet.Put( SvxFrameDirectionItem( (SvxFrameDirection)nDirection, RES_FRAMEDIR)); + } + return sal_True; +} + +/*-------------------------------------------------------------------- + Beschreibung: ColumnManager updaten + --------------------------------------------------------------------*/ + + + +IMPL_LINK( SwColumnPage, UpdateColMgr, void *, /*pField*/ ) +{ + long nGutterWidth = pColMgr->GetGutterWidth(); + if(nCols > 1) + { + // Ermitteln, ob die schmalste Spalte zu schmal ist + // fuer den eingestellten Spaltenabstand + long nMin = nColWidth[0]; + sal_uInt16 i; + + for( i = 1; i < nCols; ++i) + nMin = Min(nMin, nColWidth[i]); + + sal_Bool bAutoWidth = aAutoWidthBox.IsChecked(); + if(!bAutoWidth) + { + pColMgr->SetAutoWidth(sal_False); + // falls der Benutzer nicht die Gesamtbreite vergeben hat, + // den fehlenden Betrag auf die letzte Spalte addieren. + long nSum = 0; + for(i = 0; i < nCols; ++i) + nSum += nColWidth[i]; + nGutterWidth = 0; + for(i = 0; i < nCols - 1; ++i) + nGutterWidth += nColDist[i]; + nSum += nGutterWidth; + + long nMaxW = pColMgr->GetActualSize(); + + if( nSum < nMaxW ) + nColWidth[nCols - 1] += nMaxW - nSum; + + pColMgr->SetColWidth( 0, static_cast< sal_uInt16 >(nColWidth[0] + (sal_uInt16)nColDist[0]/2) ); + for( i = 1; i < nCols-1; ++i ) + { + long nActDist = (nColDist[i] + nColDist[i - 1]) / 2; + pColMgr->SetColWidth( i, (sal_uInt16)nColWidth[i] + (sal_uInt16)nActDist ); + } + pColMgr->SetColWidth( nCols-1, static_cast< sal_uInt16 >(nColWidth[nCols-1] + nColDist[nCols -2]/2) ); + + } + + // keins ist ausgeschaltet + const sal_uInt16 nPos = aLineTypeDLB.GetSelectEntryPos(); + sal_Bool bEnable = 0 != nPos; + aLineHeightEdit.Enable( bEnable ); + aLineHeightLbl.Enable( bEnable ); + if( !bEnable ) + pColMgr->SetNoLine(); + else if( LISTBOX_ENTRY_NOTFOUND != nPos ) + { + pColMgr->SetLineWidthAndColor(nLines[nPos - 1], Color(COL_BLACK) ); + pColMgr->SetAdjust( SwColLineAdj( + aLinePosDLB.GetSelectEntryPos() + 1) ); + pColMgr->SetLineHeightPercent((short)aLineHeightEdit.GetValue()); + bEnable = pColMgr->GetLineHeightPercent() != 100; + } + aLinePosLbl.Enable( bEnable ); + aLinePosDLB.Enable( bEnable ); + } + else + { + pColMgr->NoCols(); + nCols = 0; + } + + //Maximalwerte setzen + aCLNrEdt.SetMax(Max(1L, + Min(long(nMaxCols), long( pColMgr->GetActualSize() / (nGutterWidth + MINLAY)) ))); + aCLNrEdt.SetLast(aCLNrEdt.GetMax()); + aCLNrEdt.Reformat(); + + //Beispielfenster anregen + if(!bLockUpdate) + { + if(bFrm) + { + aFrmExampleWN.SetColumns( pColMgr->GetColumns() ); + aFrmExampleWN.Invalidate(); + } + else + aPgeExampleWN.Invalidate(); + } + + return 0; +} + +/*------------------------------------------------------------------------ + Beschreibung: Initialisierung +------------------------------------------------------------------------*/ + + + +void SwColumnPage::Init() +{ + aCLNrEdt.SetValue(nCols); + + sal_Bool bAutoWidth = pColMgr->IsAutoWidth() || bHtmlMode; + aAutoWidthBox.Check( bAutoWidth ); + + sal_Int32 nColumnWidthSum = 0; + // Setzen der Breiten + sal_uInt16 i; + for(i = 0; i < nCols; ++i) + { + nColWidth[i] = pColMgr->GetColWidth(i); + nColumnWidthSum += nColWidth[i]; + if(i < nCols - 1) + nColDist[i] = pColMgr->GetGutterWidth(i); + } + + if( 1 < nCols ) + { + // #97495# make sure that the automatic column widht's are always equal + if(bAutoWidth) + { + nColumnWidthSum /= nCols; + for(i = 0; i < nCols; ++i) + nColWidth[i] = nColumnWidthSum; + } + SwColLineAdj eAdj = pColMgr->GetAdjust(); + if( COLADJ_NONE == eAdj ) // der Dialog kennt kein NONE! + { + eAdj = COLADJ_TOP; + //ohne Adjust auch kein Linientyp + aLineTypeDLB.SelectEntryPos( 0 ); + aLineHeightEdit.SetValue( 100 ); + } + else + { + aLineTypeDLB.SelectEntryPos( lcl_LineWidthToPos(( pColMgr->GetLineWidth() )) + 1); + aLineHeightEdit.SetValue( pColMgr->GetLineHeightPercent() ); + } + aLinePosDLB.SelectEntryPos( static_cast< sal_uInt16 >(eAdj - 1) ); + } + else + { + aLinePosDLB.SelectEntryPos( 0 ); + aLineTypeDLB.SelectEntryPos( 0 ); + aLineHeightEdit.SetValue( 100 ); + } + + UpdateCols(); + Update(); + + // Maximale Spaltenzahl setzen + // Werte kleiner als 1 sind nicht erlaubt + aCLNrEdt.SetMax(Max(1L, + Min(long(nMaxCols), long( pColMgr->GetActualSize() / nMinWidth) ))); +} + +/*------------------------------------------------------------------------ + Beschreibung: Die Anzahl der Spalten hat sich veraendert -- hier werden + die Controls fuer die Bearbeitung der Spalten entsprechend + der Spaltenzahl en- oder disabled. + Falls es mehr als nVisCols (= 3) Spalten gibt, werden + alle Edit enabled und die Buttons fuer das Scrollen + ebenfalls. + Andernfalls werden die Edits jeweils fuer die entsprechenden + Spaltenzahl enabled; eine Spalte kann nicht bearbeitet werden. +------------------------------------------------------------------------*/ + + + +void SwColumnPage::UpdateCols() +{ + sal_Bool bEnableBtns= sal_False; + sal_Bool bEnable12 = sal_False; + sal_Bool bEnable3 = sal_False; + const sal_Bool bEdit = !aAutoWidthBox.IsChecked(); + if ( nCols > nVisCols ) + { + bEnableBtns = sal_True && !bHtmlMode; + bEnable12 = bEnable3 = bEdit; + } + else if( bEdit ) + { + // hier gibt es absichtlich kaum noch breaks + switch(nCols) + { + case 3: bEnable3 = sal_True; + case 2: bEnable12= sal_True; break; + default: /* do nothing */; + } + } + aEd1.Enable( bEnable12 ); + aDistEd1.Enable(nCols > 1); + aEd2.Enable( bEnable12 ); + aDistEd2.Enable(bEnable3); + aEd3.Enable( bEnable3 ); + aLbl1.Enable(bEnable12 ); + aLbl2.Enable(bEnable12 ); + aLbl3.Enable(bEnable3 ); + aBtnUp.Enable( bEnableBtns ); + aBtnDown.Enable( bEnableBtns ); + + const sal_Bool bEnable = nCols > 1; + if( !bEnable ) + { + aLinePosDLB.Enable( sal_False ); + aLinePosLbl.Enable( sal_False ); + } + aLineHeightEdit.Enable( bEnable ); + aLineHeightLbl.Enable( bEnable ); + aLineTypeDLB.Enable( bEnable ); + aLineTypeLbl.Enable( bEnable ); + aAutoWidthBox.Enable( bEnable && !bHtmlMode ); +} + +void SwColumnPage::SetLabels( sal_uInt16 nVis ) +{ + String sLbl( '~' ); + + String sLbl2( String::CreateFromInt32( nVis + 1 )); + String tmp1(sLbl2); + sLbl2.Insert(sLbl, sLbl2.Len() - 1); + aLbl1.SetText(sLbl2); + + sLbl2 = String::CreateFromInt32( nVis + 2 ); + String tmp2(sLbl2); + sLbl2.Insert(sLbl, sLbl2.Len() - 1); + aLbl2.SetText(sLbl2); + + sLbl2 = String::CreateFromInt32( nVis + 3 ); + String tmp3(sLbl2); + sLbl2.Insert(sLbl, sLbl2.Len() - 1); + aLbl3.SetText(sLbl2); + String sColumnWidth = SW_RESSTR( STR_ACCESS_COLUMN_WIDTH ) ; + sColumnWidth.SearchAndReplaceAscii("%1", tmp1); + aEd1.SetAccessibleName(sColumnWidth); + + sColumnWidth = SW_RESSTR( STR_ACCESS_COLUMN_WIDTH ) ; + sColumnWidth.SearchAndReplaceAscii("%1", tmp2); + aEd2.SetAccessibleName(sColumnWidth); + + sColumnWidth = SW_RESSTR( STR_ACCESS_COLUMN_WIDTH ) ; + sColumnWidth.SearchAndReplaceAscii("%1", tmp3); + aEd3.SetAccessibleName(sColumnWidth); + + String sDist = SW_RESSTR( STR_ACCESS_PAGESETUP_SPACING ) ; + String sDist1 = sDist; + sDist1.SearchAndReplaceAscii("%1", tmp1); + sDist1.SearchAndReplaceAscii("%2", tmp2); + aDistEd1.SetAccessibleName(sDist1); + + String sDist2 = sDist; + sDist2.SearchAndReplaceAscii("%1", tmp2); + sDist2.SearchAndReplaceAscii("%2", tmp3); + aDistEd2.SetAccessibleName(sDist2); +} + +/*------------------------------------------------------------------------ + Beschreibung: Handler, der bei einer Veraenderung der Spaltenzahl + gerufen wird. + Eine Aenderung der Spaltenzahl ueberschreibt eventuelle + Breiteneinstellungen des Benutzers; alle Spalten sind + gleich breit. +------------------------------------------------------------------------*/ + +IMPL_LINK( SwColumnPage, ColModify, NumericField *, pNF ) +{ + nCols = (sal_uInt16)aCLNrEdt.GetValue(); + //#107890# the handler is also called from LoseFocus() + //then no change has been made and thus no action should be taken + // #i17816# changing the displayed types within the ValueSet + //from two columns to two columns with different settings doesn't invalidate the + // example windows in ::ColModify() + if(!pNF ||(pColMgr->GetCount() != nCols)) + { + if(pNF) + aDefaultVS.SetNoSelection(); + long nDist = static_cast< long >(aDistEd1.DenormalizePercent(aDistEd1.GetValue(FUNIT_TWIP))); + pColMgr->SetCount(nCols, (sal_uInt16)nDist); + for(sal_uInt16 i = 0; i < nCols; i++) + nColDist[i] = nDist; + nFirstVis = 0; + SetLabels( nFirstVis ); + UpdateCols(); + ResetColWidth(); + Update(); + } + + return 0; +} + +/*------------------------------------------------------------------------ + Beschreibung: Modify- Handler fuer eine Aenderung der Spaltenbreite + oder des Spaltenabstandes. + Diese Aenderungen wirken sich erst zeitversetzt aus. + Durch eine Aenderung der Spaltenbreite wird die automatische + Berechnung der Spaltenbreite ausser Kraft gesetzt; erst + eine Aenderung der Spaltenzahl kehrt wieder zu diesem + Default zurueck. +------------------------------------------------------------------------*/ + + + +IMPL_LINK( SwColumnPage, GapModify, PercentField *, pFld ) +{ + long nActValue = static_cast< long >(pFld->DenormalizePercent(pFld->GetValue(FUNIT_TWIP))); + if(nCols < 2) + return 0; + if(aAutoWidthBox.IsChecked()) + { + sal_uInt16 nMaxGap = pColMgr->GetActualSize() - nCols * MINLAY; + DBG_ASSERT(nCols, "Abstand kann nicht ohne Spalten eingestellt werden"); + nMaxGap /= nCols - 1; + if(nActValue > nMaxGap) + { + nActValue = nMaxGap; + aDistEd1.SetPrcntValue(aDistEd1.NormalizePercent(nMaxGap), FUNIT_TWIP); + } + pColMgr->SetGutterWidth((sal_uInt16)nActValue); + for(sal_uInt16 i = 0; i < nCols; i++) + nColDist[i] = nActValue; + + ResetColWidth(); + UpdateCols(); + } + else + + { + sal_uInt16 nOffset = 0; + if(pFld == &aDistEd2) + { + nOffset = 1; + } + long nDiff = nActValue - nColDist[nFirstVis + nOffset]; + if(nDiff) + { + long nLeft = nColWidth[nFirstVis + nOffset]; + long nRight = nColWidth[nFirstVis + nOffset + 1]; + if(nLeft + nRight + 2 * MINLAY < nDiff) + nDiff = nLeft + nRight - 2 * MINLAY; + if(nDiff < nRight - MINLAY) + { + nRight -= nDiff; + } + else + { + long nTemp = nDiff - nRight + MINLAY; + nRight = MINLAY; + if(nLeft > nTemp - MINLAY) + { + nLeft -= nTemp; + nTemp = 0; + } + else + { + nTemp -= nLeft + MINLAY; + nLeft = MINLAY; + } + nDiff = nTemp; + } + nColWidth[nFirstVis + nOffset] = nLeft; + nColWidth[nFirstVis + nOffset + 1] = nRight; + nColDist[nFirstVis + nOffset] += nDiff; + + pColMgr->SetColWidth( nFirstVis + nOffset, sal_uInt16(nLeft) ); + pColMgr->SetColWidth( nFirstVis + nOffset + 1, sal_uInt16(nRight) ); + pColMgr->SetGutterWidth( sal_uInt16(nColDist[nFirstVis + nOffset]), nFirstVis + nOffset ); + } + + } + Update(); + return 0; +} + +/*------------------------------------------------------------------------ + Beschreibung: +------------------------------------------------------------------------*/ + + + +IMPL_LINK( SwColumnPage, EdModify, PercentField *, pField ) +{ + pModifiedField = pField; + Timeout(0); + return 0; +} +/*------------------------------------------------------------------------ + Beschreibung: Handler hinter der Checkbox fuer automatische Breite. + Ist die Box gecheckt, koennen keine expliziten Werte + fuer die Spaltenbreite eingegeben werden. +------------------------------------------------------------------------*/ + + + +IMPL_LINK( SwColumnPage, AutoWidthHdl, CheckBox *, pBox ) +{ + long nDist = static_cast< long >(aDistEd1.DenormalizePercent(aDistEd1.GetValue(FUNIT_TWIP))); + pColMgr->SetCount(nCols, (sal_uInt16)nDist); + for(sal_uInt16 i = 0; i < nCols; i++) + nColDist[i] = nDist; + if(pBox->IsChecked()) + { + pColMgr->SetGutterWidth(sal_uInt16(nDist)); + ResetColWidth(); + } + pColMgr->SetAutoWidth(pBox->IsChecked(), sal_uInt16(nDist)); + UpdateCols(); + Update(); + return 0; +} + +/*------------------------------------------------------------------------ + Beschreibung: Raufscrollen der Inhalte der Edits. +------------------------------------------------------------------------*/ + +IMPL_LINK( SwColumnPage, Up, Button *, EMPTYARG ) +{ + if( nFirstVis ) + { + --nFirstVis; + SetLabels( nFirstVis ); + Update(); + } + return 0; +} +/*------------------------------------------------------------------------ + Beschreibung: Runterscrollen der Inhalte der Edits. +------------------------------------------------------------------------*/ + +IMPL_LINK( SwColumnPage, Down, Button *, EMPTYARG ) +{ + if( nFirstVis + nVisCols < nCols ) + { + ++nFirstVis; + SetLabels( nFirstVis ); + Update(); + } + return 0; +} +/*------------------------------------------------------------------------ + Beschreibung: Relikt aus alten Zeiten - jetzt direkt ohne time + * Timer- Handler; angetriggert durch eine Aenderung der + Spaltenbreite oder des Spaltenabstandes. +------------------------------------------------------------------------*/ + +IMPL_LINK( SwColumnPage, Timeout, Timer *, EMPTYARG ) +{ + DBG_PROFSTART(columnhdl) ; + if(pModifiedField) + { + // Finden der veraenderten Spalte + sal_uInt16 nChanged = nFirstVis; + if(pModifiedField == &aEd2) + ++nChanged; + else if(pModifiedField == &aEd3) + nChanged += 2; + /*else if(pModifiedField == &aEd4) + nChanged += 3;*/ + + long nNewWidth = (sal_uInt16) + pModifiedField->DenormalizePercent(pModifiedField->GetValue(FUNIT_TWIP)); + long nDiff = nNewWidth - nColWidth[nChanged]; + + // wenn es die letzte Spalte ist + if(nChanged == nCols - 1) + { + nColWidth[0] -= nDiff; + if(nColWidth[0] < (long)nMinWidth) + { + nNewWidth -= nMinWidth - nColWidth[0]; + nColWidth[0] = nMinWidth; + } + + } + else if(nDiff) + { + nColWidth[nChanged + 1] -= nDiff; + if(nColWidth[nChanged + 1] < (long) nMinWidth) + { + nNewWidth -= nMinWidth - nColWidth[nChanged + 1]; + nColWidth[nChanged + 1] = nMinWidth; + } + } + nColWidth[nChanged] = nNewWidth; + pModifiedField = 0; + } + Update(); + DBG_PROFSTOP(columnhdl) ; + return 0; +} +/*------------------------------------------------------------------------ + Beschreibung: Aktualisierung der Anzeige +------------------------------------------------------------------------*/ + + + +void SwColumnPage::Update() +{ + aBalanceColsCB.Enable(nCols > 1); + if(nCols >= 2) + { + aEd1.SetPrcntValue(aEd1.NormalizePercent(nColWidth[nFirstVis]), FUNIT_TWIP); + aDistEd1.SetPrcntValue(aDistEd1.NormalizePercent(nColDist[nFirstVis]), FUNIT_TWIP); + aEd2.SetPrcntValue(aEd2.NormalizePercent(nColWidth[nFirstVis + 1]), FUNIT_TWIP); + if(nCols >= 3) + { + aDistEd2.SetPrcntValue(aDistEd2.NormalizePercent(nColDist[nFirstVis + 1]), FUNIT_TWIP); + aEd3.SetPrcntValue(aEd3.NormalizePercent(nColWidth[nFirstVis + 2]), FUNIT_TWIP); + } + else + { + aEd3.SetText(aEmptyStr); + aDistEd2.SetText(aEmptyStr); + } + } + else + { + aEd1.SetText(aEmptyStr); + aEd2.SetText(aEmptyStr); + aEd3.SetText(aEmptyStr); + aDistEd1.SetText(aEmptyStr); + aDistEd2.SetText(aEmptyStr); + } + UpdateColMgr(0); +} + +/*-------------------------------------------------------------------- + Beschreibung: Update Bsp + --------------------------------------------------------------------*/ + + + +void SwColumnPage::ActivatePage(const SfxItemSet& rSet) +{ + if(!bFrm) + { + if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_PAGE_SIZE )) + { + const SvxSizeItem& rSize = (const SvxSizeItem&)rSet.Get( + SID_ATTR_PAGE_SIZE); + const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&)rSet.Get( + RES_LR_SPACE ); + const SvxBoxItem& rBox = (const SvxBoxItem&) rSet.Get(RES_BOX); + sal_uInt16 nActWidth = static_cast< sal_uInt16 >(rSize.GetSize().Width() + - rLRSpace.GetLeft() - rLRSpace.GetRight() - rBox.GetDistance()); + + if( pColMgr->GetActualSize() != nActWidth) + { + pColMgr->SetActualWidth(nActWidth); + ColModify( 0 ); + UpdateColMgr( 0 ); + } + } + aFrmExampleWN.Hide(); + aPgeExampleWN.UpdateExample( rSet, pColMgr ); + aPgeExampleWN.Show(); + + } + else + { + aPgeExampleWN.Hide(); + aFrmExampleWN.Show(); + + // Size + const SwFmtFrmSize& rSize = (const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE); + const SvxBoxItem& rBox = (const SvxBoxItem&) rSet.Get(RES_BOX); + + long nDistance = rBox.GetDistance(); + const sal_uInt16 nTotalWish = bFormat ? FRAME_FORMAT_WIDTH : sal_uInt16(rSize.GetWidth() - 2 * nDistance); + + // Maximalwerte der Spaltenbreiten setzen + SetPageWidth(nTotalWish); + + if(pColMgr->GetActualSize() != nTotalWish) + { + pColMgr->SetActualWidth(nTotalWish); + Init(); + } + sal_Bool bPercent; + // im Rahmenformat nur relative Angaben + if ( bFormat || (rSize.GetWidthPercent() && rSize.GetWidthPercent() != 0xff) ) + { + // Wert fuer 100% setzen + aEd1.SetRefValue(nTotalWish); + aEd2.SetRefValue(nTotalWish); + aEd3.SetRefValue(nTotalWish); + aDistEd1.SetRefValue(nTotalWish); + aDistEd2.SetRefValue(nTotalWish); + + // Auf %-Darstellung umschalten + bPercent = sal_True; + } + else + bPercent = sal_False; + + aEd1.ShowPercent(bPercent); + aEd2.ShowPercent(bPercent); + aEd3.ShowPercent(bPercent); + aDistEd1.ShowPercent(bPercent); + aDistEd2.ShowPercent(bPercent); + aDistEd1.MetricField::SetMin(0); + aDistEd2.MetricField::SetMin(0); + } + Update(); +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + + + +int SwColumnPage::DeactivatePage(SfxItemSet *_pSet) +{ + if(_pSet) + FillItemSet(*_pSet); + + return sal_True; +} + + + +sal_uInt16* SwColumnPage::GetRanges() +{ + return aPageRg; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + + + +IMPL_LINK( SwColumnPage, SetDefaultsHdl, ValueSet *, pVS ) +{ + sal_uInt16 nItem = pVS->GetSelectItemId(); + if( nItem < 4 ) + { + aCLNrEdt.SetValue( nItem ); + aAutoWidthBox.Check(); + aDistEd1.SetPrcntValue(0); + ColModify(0); + } + else + { + bLockUpdate = sal_True; + aCLNrEdt.SetValue( 2 ); + aAutoWidthBox.Check(sal_False); + aDistEd1.SetPrcntValue(0); + ColModify(0); + // jetzt noch das Breitenverhaeltnisse auf 2 : 1 bzw. 1 : 2 stellen + sal_uInt16 nSmall = pColMgr->GetActualSize() / 3; + if(nItem == 4) + { + aEd2.SetPrcntValue(aEd2.NormalizePercent(long(nSmall)), FUNIT_TWIP); + pModifiedField = &aEd2; + } + else + { + aEd1.SetPrcntValue(aEd1.NormalizePercent(long(nSmall)), FUNIT_TWIP); + pModifiedField = &aEd1; + } + bLockUpdate = sal_False; + Timeout(0); + + } + return 0; +} + +/*-----------------25.10.96 11.41------------------- + +--------------------------------------------------*/ + + +void SwColumnPage::SetFrmMode(sal_Bool bMod) +{ + bFrm = bMod; +} +/* -----------------------------2002/06/19 13:08------------------------------ + + ---------------------------------------------------------------------------*/ +void SwColumnPage::SetInSection(sal_Bool bSet) +{ + if(!SW_MOD()->GetCTLOptions().IsCTLFontEnabled()) + return; + + aVertFL.Show(bSet); + aPropertiesFL.Show(bSet); + aTextDirectionFT.Show(bSet); + aTextDirectionLB.Show(bSet); + if(bSet) + { + //resize line type FixedLine + Point aLtPos = aFLLineType.GetPosPixel(); + Point aPropPos = aPropertiesFL.GetPosPixel(); + Size aSz = aFLLineType.GetSizePixel(); + aSz.Width() = aPropPos.X() - aLtPos.X() - LogicToPixel(Size(8, 8), MAP_APPFONT).Width(); + aFLLineType.SetSizePixel(aSz); + } + else + { + Size aSz = aFLLineType.GetSizePixel(); + aSz.Width() = LogicToPixel(Size(248, 248), MAP_APPFONT).Width(); + aFLLineType.SetSizePixel(aSz); + } +} + +/*-----------------07.03.97 08.33------------------- + +--------------------------------------------------*/ + + +void ColumnValueSet::UserDraw( const UserDrawEvent& rUDEvt ) +{ + OutputDevice* pDev = rUDEvt.GetDevice(); + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + + Rectangle aRect = rUDEvt.GetRect(); + sal_uInt16 nItemId = rUDEvt.GetItemId(); + long nRectWidth = aRect.GetWidth(); + long nRectHeight = aRect.GetHeight(); + + Point aBLPos = aRect.TopLeft(); + Color aFillColor(pDev->GetFillColor()); + Color aLineColor(pDev->GetLineColor()); + pDev->SetFillColor(rStyleSettings.GetFieldColor()); + pDev->SetLineColor(SwViewOption::GetFontColor()); + + long nStep = Abs(Abs(nRectHeight * 95 /100) / 11); + long nTop = (nRectHeight - 11 * nStep ) / 2; + sal_uInt16 nCols = 0; + long nStarts[3]; + long nEnds[3]; + nStarts[0] = nRectWidth * 10 / 100; + switch( nItemId ) + { + case 1: + nEnds[0] = nRectWidth * 9 / 10; + nCols = 1; + break; + case 2: nCols = 2; + nEnds[0] = nRectWidth * 45 / 100; + nStarts[1] = nEnds[0] + nStep; + nEnds[1] = nRectWidth * 9 / 10; + break; + case 3: nCols = 3; + nEnds[0] = nRectWidth * 30 / 100; + nStarts[1] = nEnds[0] + nStep; + nEnds[1] = nRectWidth * 63 / 100; + nStarts[2] = nEnds[1] + nStep; + nEnds[2] = nRectWidth * 9 / 10; + break; + case 4: nCols = 2; + nEnds[0] = nRectWidth * 63 / 100; + nStarts[1] = nEnds[0] + nStep; + nEnds[1] = nRectWidth * 9 / 10; + break; + case 5: nCols = 2; + nEnds[0] = nRectWidth * 30 / 100; + nStarts[1] = nEnds[0] + nStep; + nEnds[1] = nRectWidth * 9 / 10; + break; + } + for(sal_uInt16 j = 0; j < nCols; j++ ) + { + Point aStart(aBLPos.X() + nStarts[j], 0); + Point aEnd(aBLPos.X() + nEnds[j], 0); + for( sal_uInt16 i = 0; i < 12; i ++) + { + aStart.Y() = aEnd.Y() = aBLPos.Y() + nTop + i * nStep; + pDev->DrawLine(aStart, aEnd); + } + } + pDev->SetFillColor(aFillColor); + pDev->SetLineColor(aLineColor); +} + +/*-----------------07.03.97 08.48------------------- + +--------------------------------------------------*/ + +ColumnValueSet::~ColumnValueSet() +{ +} +/* -----------------------------02.04.2002 16:01------------------------------ + + ---------------------------------------------------------------------------*/ +void ColumnValueSet::DataChanged( const DataChangedEvent& rDCEvt ) +{ + if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && + (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + { + Format(); + } + ValueSet::DataChanged( rDCEvt ); +} + diff --git a/sw/source/ui/frmdlg/column.hrc b/sw/source/ui/frmdlg/column.hrc new file mode 100644 index 000000000000..e46697a8c618 --- /dev/null +++ b/sw/source/ui/frmdlg/column.hrc @@ -0,0 +1,86 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define FT_NUMBER 1 +#define ED_NUMBER 2 +#define FT_DISTANCE 3 +#define ED_DISTANCE 4 +#define CB_AUTO_WIDTH 4 +#define FL_COLUMNS 6 + +#define FT_1 20 +#define FT_2 21 +#define FT_3 22 + + +#define ED_1 25 +#define ED_2 26 +#define ED_3 27 + + +#define BTN_UP 30 +#define BTN_DOWN 31 +#define FL_LAYOUT 32 + +#define FT_STYLE 33 +#define LB_STYLE 34 +#define FT_HEIGHT 35 +#define ED_HEIGHT 36 +#define FT_POSITION 37 +#define LB_POSITION 38 +#define FL_LINETYPE 39 + +#define WN_BSP 41 + +#define LB_REFERENCE 42 +#define CB_REGISTER 43 +#define FL_REGISTER 44 +#define FT_REFERENCE 45 + +#define ED_DIST1 46 +#define ED_DIST2 47 + +#define FT_COLUMN 48 +#define FT_WIDTH 49 +#define FT_DIST 50 +#define VS_DEFAULTS 51 +#define IL_PRE_COLS 52 + +#define FT_APPLY_TO 53 +#define LB_APPLY_TO 54 +#define PB_HELP 55 +#define PB_CANCEL 56 +#define PB_OK 57 +#define CB_BALANCECOLS 58 +#define FL_PROPERTIES 59 +#define FT_TEXTDIRECTION 60 +#define LB_TEXTDIRECTION 61 +#define FL_VERT 62 +#define LISTBOX_SELECTION 0 +#define LISTBOX_SECTION 1 +#define LISTBOX_SECTIONS 2 +#define LISTBOX_PAGE 3 +#define LISTBOX_FRAME 4 diff --git a/sw/source/ui/frmdlg/column.src b/sw/source/ui/frmdlg/column.src new file mode 100644 index 000000000000..c5ba19c9a958 --- /dev/null +++ b/sw/source/ui/frmdlg/column.src @@ -0,0 +1,431 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "globals.hrc" +#include "column.hrc" +#include "frmui.hrc" +#include "cmdid.h" +#include "helpid.h" +#include "access.hrc" + + // #define TP_COLUMN 256 +TabPage TP_COLUMN +{ + HelpID = HID_COLUMN ; + Hide = TRUE; + Size = MAP_APPFONT ( 260 , 185 ) ; + Text [ en-US ] = "Columns" ; + FixedText FT_NUMBER + { + Pos = MAP_APPFONT ( 12 , 19 ) ; + Size = MAP_APPFONT ( 28 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "Columns"; + }; + NumericField ED_NUMBER + { + HelpID = "sw:NumericField:TP_COLUMN:ED_NUMBER"; + Border = TRUE ; + Pos = MAP_APPFONT ( 12 , 30 ) ; + Size = MAP_APPFONT ( 24 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 20 ; + Value = 1 ; + First = 1 ; + Last = 20 ; + SpinSize = 1 ; + }; + Control VS_DEFAULTS + { + Pos = MAP_APPFONT ( 50 , 14 ) ; + Size = MAP_APPFONT ( 110 , 28 ) ; + TabStop = TRUE ; + }; + CheckBox CB_BALANCECOLS + { + HelpID = "sw:CheckBox:TP_COLUMN:CB_BALANCECOLS"; + Pos = MAP_APPFONT ( 7 , 46 ) ; + Size = MAP_APPFONT ( 163 , 10 ) ; + Hide = TRUE; + Text [ en-US ] = "Evenly distribute contents ~to all columns"; + }; + FixedLine FL_COLUMNS + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 164 , 8 ) ; + Text [ en-US ] = "Settings"; + }; + FixedText FT_COLUMN + { + Pos = MAP_APPFONT ( 12 , 70 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "Column"; + }; + Window WN_BSP + { + Pos = MAP_APPFONT ( 176 , 6 ) ; + Size = MAP_APPFONT ( 75 , 46 ) ; + }; + ImageButton BTN_DOWN + { + HelpID = "sw:ImageButton:TP_COLUMN:BTN_DOWN"; + Disable = TRUE ; + Pos = MAP_APPFONT ( 62 , 69 ) ; + Size = MAP_APPFONT ( 10 , 10 ) ; + TabStop = TRUE ; + SYMBOL = IMAGEBUTTON_ARROW_LEFT ; + }; + FixedText FT_1 + { + Pos = MAP_APPFONT ( 100 , 71 ) ; + Size = MAP_APPFONT ( 10 , 8 ) ; + Text = "~1" ; + Center = TRUE ; + }; + FixedText FT_2 + { + Pos = MAP_APPFONT ( 150 , 71 ) ; + Size = MAP_APPFONT ( 10 , 8 ) ; + Text = "~2" ; + Center = TRUE ; + }; + FixedText FT_3 + { + Pos = MAP_APPFONT ( 200 , 71 ) ; + Size = MAP_APPFONT ( 10 , 8 ) ; + Text = "~3" ; + Center = TRUE ; + }; + ImageButton BTN_UP + { + HelpID = "sw:ImageButton:TP_COLUMN:BTN_UP"; + Disable = TRUE ; + Pos = MAP_APPFONT ( 238 , 69 ) ; + Size = MAP_APPFONT ( 10 , 10 ) ; + TabStop = TRUE ; + SYMBOL = IMAGEBUTTON_ARROW_RIGHT ; + }; + FixedText FT_WIDTH + { + Pos = MAP_APPFONT ( 12 , 85 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "Width" ; + }; + MetricField ED_1 + { + HelpID = "sw:MetricField:TP_COLUMN:ED_1"; + Disable = TRUE ; + Border = TRUE ; + Pos = MAP_APPFONT ( 87 , 83 ) ; + Size = MAP_APPFONT ( 36 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 5600 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + First = 10 ; + Last = 5600 ; + SpinSize = 10 ; + }; + MetricField ED_2 + { + HelpID = "sw:MetricField:TP_COLUMN:ED_2"; + Disable = TRUE ; + Border = TRUE ; + Pos = MAP_APPFONT ( 137 , 83 ) ; + Size = MAP_APPFONT ( 36 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 5600 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + First = 10 ; + Last = 5600 ; + SpinSize = 10 ; + }; + MetricField ED_3 + { + HelpID = "sw:MetricField:TP_COLUMN:ED_3"; + Disable = TRUE ; + Border = TRUE ; + Pos = MAP_APPFONT ( 187 , 83 ) ; + Size = MAP_APPFONT ( 36 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 1 ; + Maximum = 5600 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + First = 10 ; + Last = 5600 ; + SpinSize = 10 ; + }; + FixedText FT_DIST + { + Pos = MAP_APPFONT ( 12 , 101 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "Spacing" ; + }; + MetricField ED_DIST1 + { + HelpID = "sw:MetricField:TP_COLUMN:ED_DIST1"; + Disable = TRUE ; + Border = TRUE ; + Pos = MAP_APPFONT ( 112 , 99 ) ; + Size = MAP_APPFONT ( 36 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 0 ; + Maximum = 5600 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + First = 10 ; + Last = 5600 ; + SpinSize = 10 ; + }; + MetricField ED_DIST2 + { + HelpID = "sw:MetricField:TP_COLUMN:ED_DIST2"; + Disable = TRUE ; + Border = TRUE ; + Pos = MAP_APPFONT ( 162 , 99 ) ; + Size = MAP_APPFONT ( 36 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 0 ; + Maximum = 5600 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + First = 10 ; + Last = 5600 ; + SpinSize = 10 ; + }; + CheckBox CB_AUTO_WIDTH + { + HelpID = "sw:CheckBox:TP_COLUMN:CB_AUTO_WIDTH"; + Pos = MAP_APPFONT ( 87 , 115 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + Text [ en-US ] = "Auto~Width" ; + TabStop = TRUE ; + }; + FixedLine FL_LAYOUT + { + Pos = MAP_APPFONT ( 6 , 58 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Width and spacing"; + }; + + FixedText FT_STYLE + { + Pos = MAP_APPFONT ( 12 , 140 ) ; + Size = MAP_APPFONT ( 35 , 8 ) ; + Text [ en-US ] = "~Line" ; + Left = TRUE ; + }; + ListBox LB_STYLE + { + HelpID = "sw:ListBox:TP_COLUMN:LB_STYLE"; + Pos = MAP_APPFONT ( 50 , 138 ) ; + Size = MAP_APPFONT ( 60 , 66 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "None" ; Default ; > ; + }; + }; + FixedText FT_HEIGHT + { + Pos = MAP_APPFONT ( 12 , 156 ) ; + Size = MAP_APPFONT ( 35 , 8 ) ; + Text [ en-US ] = "H~eight" ; + Left = TRUE ; + }; + MetricField ED_HEIGHT + { + HelpID = "sw:MetricField:TP_COLUMN:ED_HEIGHT"; + Border = TRUE ; + Pos = MAP_APPFONT ( 50 , 154 ) ; + Size = MAP_APPFONT ( 60 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 25 ; + Maximum = 100 ; + Value = 100 ; + Unit = FUNIT_CUSTOM ; + CustomUnitText = "%" ; + First = 25 ; + Last = 100 ; + }; + FixedText FT_POSITION + { + Pos = MAP_APPFONT ( 12 , 172 ) ; + Size = MAP_APPFONT ( 35 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "~Position" ; + }; + ListBox LB_POSITION + { + HelpID = "sw:ListBox:TP_COLUMN:LB_POSITION"; + Pos = MAP_APPFONT ( 50 , 170 ) ; + Size = MAP_APPFONT ( 60 , 40 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "Top" ; Default ; > ; + < "Centered" ; Default ; > ; + < "Bottom" ; Default ; > ; + }; + }; + FixedLine FL_LINETYPE + { + Pos = MAP_APPFONT ( 6 , 127 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Separator line" ; + }; + FixedLine FL_VERT + { + Pos = MAP_APPFONT ( 116 , 138 ) ; + Size = MAP_APPFONT ( 4 , 43 ) ; + Hide = TRUE ; + Vert = TRUE; + }; + FixedLine FL_PROPERTIES + { + Pos = MAP_APPFONT ( 121 , 127 ) ; + Size = MAP_APPFONT ( 133 , 8 ) ; + Hide = TRUE ; + Text [ en-US ] = "Properties"; + }; + FixedText FT_TEXTDIRECTION + { + Pos = MAP_APPFONT ( 127 , 138 ) ; + Size = MAP_APPFONT ( 127 , 8 ) ; + Hide = TRUE ; + Text [ en-US ] = "Text ~direction"; + }; + ListBox LB_TEXTDIRECTION + { + HelpID = "sw:ListBox:TP_COLUMN:LB_TEXTDIRECTION"; + Border = TRUE ; + Pos = MAP_APPFONT ( 127 , 149 ) ; + Size = MAP_APPFONT ( 127 , 50 ) ; + DropDown = TRUE ; + Hide = TRUE ; + StringList [ en-US ] = + { + < "Left-to-right" ; 0; > ; + < "Right-to-left" ; 1; > ; + < "Use superordinate object settings" ; 4; > ; + }; + }; +}; + +ModalDialog DLG_COLUMN +{ + HelpID = HID_FORMAT_COLUMN; + Hide = TRUE; + Moveable = TRUE; + Size = MAP_APPFONT ( 316 , 135 ) ; + OKButton PB_OK + { + DefButton = TRUE ; + Pos = MAP_APPFONT ( 260 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + CancelButton PB_CANCEL + { + Pos = MAP_APPFONT ( 260 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton PB_HELP + { + Pos = MAP_APPFONT ( 260 , 43 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + FixedText FT_APPLY_TO + { + Pos = MAP_APPFONT ( 260 , 63 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "~Apply to"; + }; + ListBox LB_APPLY_TO + { + HelpID = "sw:ListBox:DLG_COLUMN:LB_APPLY_TO"; + Pos = MAP_APPFONT ( 260 , 74 ) ; + Size = MAP_APPFONT ( 50 , 66 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "Selection" ; LISTBOX_SELECTION; > ; + < "Current Section" ; LISTBOX_SECTION ; > ; + < "Selected section" ; LISTBOX_SECTIONS ; > ; + < "Frame" ; LISTBOX_FRAME ; > ; + < "Page Style: " ; LISTBOX_PAGE ; > ; + }; + }; + Text [ en-US ] = "Columns"; +}; + +//IAccessibility2 Impplementaton 2009----- +String STR_ACCESS_PAGESETUP_SPACING +{ + Text [ en-US ] = "Spacing between %1 and %2"; +}; + +String STR_ACCESS_COLUMN_WIDTH +{ + Text [ en-US ] = "Column %1 Width"; +}; +//-----IAccessibility2 Impplementaton 2009 diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx new file mode 100644 index 000000000000..0a7863270034 --- /dev/null +++ b/sw/source/ui/frmdlg/cption.cxx @@ -0,0 +1,652 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + + + +#ifndef _VIEW_HXX +#include <view.hxx> +#endif +#include <wrtsh.hxx> +#include <cption.hxx> +#include <fldmgr.hxx> +#include <expfld.hxx> +#include <numrule.hxx> +#include <poolfmt.hxx> +#include <docsh.hxx> +#include <frmfmt.hxx> +#include <calc.hxx> +#include <uitool.hxx> +#include <doc.hxx> +#include <modcfg.hxx> +#include <swmodule.hxx> +#include <com/sun/star/frame/XStorable.hpp> +#include <com/sun/star/text/GraphicCrop.hpp> +#include <com/sun/star/text/XTextGraphicObjectsSupplier.hpp> +#include <com/sun/star/text/XTextTableCursor.hpp> +#include <com/sun/star/text/XTextTablesSupplier.hpp> +#include <com/sun/star/text/TableColumnSeparator.hpp> +#include <com/sun/star/text/XTextTable.hpp> +#include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp> +#include <com/sun/star/text/XTextEmbeddedObject.hpp> +#include <com/sun/star/text/XTextFramesSupplier.hpp> +#include <com/sun/star/text/XTextFrame.hpp> + +#ifndef _FRMUI_HRC +#include <frmui.hrc> +#endif +#ifndef _CPTION_HRC +#include <cption.hrc> +#endif +#include <SwStyleNameMapper.hxx> +using namespace ::com::sun::star; + +extern String* GetOldGrfCat(); +extern String* GetOldTabCat(); +extern String* GetOldFrmCat(); +extern String* GetOldDrwCat(); + +class SwSequenceOptionDialog : public SvxStandardDialog +{ + FixedLine aFlHeader; + FixedText aFtLevel; + ListBox aLbLevel; + FixedText aFtDelim; + Edit aEdDelim; + + FixedLine aFlCatAndFrame; + FixedText aFtCharStyle; + ListBox aLbCharStyle; + CheckBox aApplyBorderAndShadowCB; + + //#i61007# order of captions + FixedLine aFlCaptionOrder; + FixedText aFtCaptionOrder; + ListBox aLbCaptionOrder; + + OKButton aOKButton; + CancelButton aCancelButton; + HelpButton aHelpButton; + + SwView& rView; + String aFldTypeName; + +public: + SwSequenceOptionDialog( Window *pParent, SwView &rV, + const String& rSeqFldType ); + virtual ~SwSequenceOptionDialog(); + virtual void Apply(); + + bool IsApplyBorderAndShadow( void ) { return aApplyBorderAndShadowCB.IsChecked(); } + void SetApplyBorderAndShadow( bool bSet ) { aApplyBorderAndShadowCB.Check(bSet); } + + //#i61007# order of captions + bool IsOrderNumberingFirst() const {return aLbCaptionOrder.GetSelectEntryPos() == 1;} + void SetOrderNumberingFirst(bool bSet) { aLbCaptionOrder.SelectEntryPos( bSet ? 1 : 0 ); } + + void SetCharacterStyle(const String& rStyle); + String GetCharacterStyle() const; +}; + +SwCaptionDialog::SwCaptionDialog( Window *pParent, SwView &rV ) : + + SvxStandardDialog( pParent, SW_RES(DLG_CAPTION) ), + + aTextText (this, SW_RES(TXT_TEXT )), + aTextEdit (this, SW_RES(EDT_TEXT )), + aSettingsFL (this, SW_RES(FL_SETTINGS)), + aCategoryText (this, SW_RES(TXT_CATEGORY)), + aCategoryBox (this, SW_RES(BOX_CATEGORY)), + aFormatText (this, SW_RES(TXT_FORMAT )), + aFormatBox (this, SW_RES(BOX_FORMAT )), + aNumberingSeparatorFT(this, SW_RES(FT_NUM_SEP )), + aNumberingSeparatorED(this, SW_RES(ED_NUM_SEP )), + aSepText (this, SW_RES(TXT_SEP )), + aSepEdit (this, SW_RES(EDT_SEP )), + aPosText (this, SW_RES(TXT_POS )), + aPosBox (this, SW_RES(BOX_POS )), + aOKButton (this, SW_RES(BTN_OK )), + aCancelButton (this, SW_RES(BTN_CANCEL )), + aHelpButton (this, SW_RES(BTN_HELP )), + aAutoCaptionButton(this, SW_RES(BTN_AUTOCAPTION)), + aOptionButton (this, SW_RES(BTN_OPTION )), + sNone( SW_RES( STR_CATEGORY_NONE )), + aPrevWin (this, SW_RES(WIN_SAMPLE )), + rView( rV ), + pMgr( new SwFldMgr(rView.GetWrtShellPtr()) ), + bCopyAttributes( sal_False ), + bOrderNumberingFirst( SW_MOD()->GetModuleConfig()->IsCaptionOrderNumberingFirst() ) +{ + //#i61007# order of captions + if( bOrderNumberingFirst ) + ApplyCaptionOrder(); + SwWrtShell &rSh = rView.GetWrtShell(); + uno::Reference< frame::XModel > xModel = rView.GetDocShell()->GetBaseModel(); + + eType = rSh.GetSelectionType(); + if ( eType & nsSelectionType::SEL_OLE ) + { + eType = nsSelectionType::SEL_GRF; + uno::Reference< text::XTextEmbeddedObjectsSupplier > xObjs(xModel, uno::UNO_QUERY); + xNameAccess = xObjs->getEmbeddedObjects(); + } + + Link aLk = LINK( this, SwCaptionDialog, ModifyHdl ); + aCategoryBox.SetModifyHdl( aLk ); + aTextEdit .SetModifyHdl( aLk ); + aNumberingSeparatorED.SetModifyHdl ( aLk ); + aSepEdit .SetModifyHdl( aLk ); + + aLk = LINK(this, SwCaptionDialog, SelectHdl); + aCategoryBox.SetSelectHdl( aLk ); + aFormatBox .SetSelectHdl( aLk ); + aOptionButton.SetClickHdl( LINK( this, SwCaptionDialog, OptionHdl ) ); + aAutoCaptionButton.SetClickHdl(LINK(this, SwCaptionDialog, CaptionHdl)); + + aCategoryBox.InsertEntry( sNone ); + sal_uInt16 i, nCount = pMgr->GetFldTypeCount(); + for (i = 0; i < nCount; i++) + { + SwFieldType *pType = pMgr->GetFldType( USHRT_MAX, i ); + if( pType->Which() == RES_SETEXPFLD && + ((SwSetExpFieldType *) pType)->GetType() & nsSwGetSetExpType::GSE_SEQ ) + aCategoryBox.InsertEntry(pType->GetName()); + } + + String* pString = 0; + sal_uInt16 nPoolId = 0; + if (eType & nsSelectionType::SEL_GRF) + { + nPoolId = RES_POOLCOLL_LABEL_ABB; + pString = ::GetOldGrfCat(); + bCopyAttributes = sal_True; + sObjectName = rSh.GetFlyName(); + //if not OLE + if(!xNameAccess.is()) + { + uno::Reference< text::XTextGraphicObjectsSupplier > xGraphics(xModel, uno::UNO_QUERY); + xNameAccess = xGraphics->getGraphicObjects(); + } + + } + else if( eType & nsSelectionType::SEL_TBL ) + { + nPoolId = RES_POOLCOLL_LABEL_TABLE; + pString = ::GetOldTabCat(); + uno::Reference< text::XTextTablesSupplier > xTables(xModel, uno::UNO_QUERY); + xNameAccess = xTables->getTextTables(); + sObjectName = rSh.GetTableFmt()->GetName(); + } + else if( eType & nsSelectionType::SEL_FRM ) + { + nPoolId = RES_POOLCOLL_LABEL_FRAME; + pString = ::GetOldFrmCat(); + uno::Reference< text::XTextFramesSupplier > xFrms(xModel, uno::UNO_QUERY); + xNameAccess = xFrms->getTextFrames(); + sObjectName = rSh.GetFlyName(); + } + else if( eType == nsSelectionType::SEL_TXT ) + { + nPoolId = RES_POOLCOLL_LABEL_FRAME; + pString = ::GetOldFrmCat(); + } + else if( eType & nsSelectionType::SEL_DRW ) + { + nPoolId = RES_POOLCOLL_LABEL_DRAWING; + pString = ::GetOldDrwCat(); + } + if( nPoolId ) + { + if( pString && pString->Len()) + aCategoryBox.SetText( *pString ); + else + aCategoryBox.SetText( + SwStyleNameMapper::GetUIName( nPoolId, aEmptyStr )); + } + + // aFormatBox + sal_uInt16 nSelFmt = SVX_NUM_ARABIC; + nCount = pMgr->GetFldTypeCount(); + SwFieldType* pFldType; + for ( i = nCount; i; ) + if( ( pFldType = pMgr->GetFldType(USHRT_MAX, --i))->GetName() == + aCategoryBox.GetText() ) + { + nSelFmt = (sal_uInt16)((SwSetExpFieldType*)pFldType)->GetSeqFormat(); + break; + } + + + nCount = pMgr->GetFormatCount(TYP_SEQFLD, sal_False); + for ( i = 0; i < nCount; ++i ) + { + aFormatBox.InsertEntry( pMgr->GetFormatStr(TYP_SEQFLD, i) ); + sal_uInt16 nFmtId = pMgr->GetFormatId(TYP_SEQFLD, i); + aFormatBox.SetEntryData( i, reinterpret_cast<void*>( nFmtId ) ); + if( nFmtId == nSelFmt ) + aFormatBox.SelectEntryPos( i ); + } + + // aPosBox + switch (eType) + { + case nsSelectionType::SEL_GRF: + case nsSelectionType::SEL_TBL: + case nsSelectionType::SEL_TBL | nsSelectionType::SEL_NUM: + case nsSelectionType::SEL_TBL | nsSelectionType::SEL_TXT: + case nsSelectionType::SEL_TBL | nsSelectionType::SEL_NUM | nsSelectionType::SEL_TXT: + case nsSelectionType::SEL_DRW: + case nsSelectionType::SEL_DRW | nsSelectionType::SEL_BEZ: + aPosBox.InsertEntry(SW_RESSTR(STR_ABOVE)); + aPosBox.InsertEntry(SW_RESSTR(STR_CP_BELOW)); + break; + case nsSelectionType::SEL_FRM: + case nsSelectionType::SEL_TXT: + aPosBox.InsertEntry(SW_RESSTR(STR_BEGINNING)); + aPosBox.InsertEntry(SW_RESSTR(STR_END )); + break; + } + aPosBox.SelectEntryPos(1); + if (eType & (nsSelectionType::SEL_GRF|nsSelectionType::SEL_DRW)) + { + aPosText.Enable( sal_False ); + aPosBox.Enable( sal_False ); + } + + aCategoryBox.GetModifyHdl().Call(&aCategoryBox); + + FreeResource(); + + CheckButtonWidth(); + aTextEdit.GrabFocus(); + DrawSample(); +} + +void SwCaptionDialog::Apply() +{ + InsCaptionOpt aOpt; + aOpt.UseCaption() = sal_True; + String aName( aCategoryBox.GetText() ); + if ( aName == sNone ) + aOpt.SetCategory( aEmptyStr ); + else + { + aName.EraseLeadingChars( ' ' ); + aName.EraseTrailingChars( ' ' ); + aOpt.SetCategory( aName ); + } + aOpt.SetNumType( (sal_uInt16)(sal_uIntPtr)aFormatBox.GetEntryData( aFormatBox.GetSelectEntryPos() ) ); + aOpt.SetSeparator( aSepEdit.IsEnabled() ? aSepEdit.GetText() : String() ); + aOpt.SetNumSeparator( aNumberingSeparatorED.GetText() ); + aOpt.SetCaption( aTextEdit.GetText() ); + aOpt.SetPos( aPosBox.GetSelectEntryPos() ); + aOpt.IgnoreSeqOpts() = sal_True; + aOpt.CopyAttributes() = bCopyAttributes; + aOpt.SetCharacterStyle( sCharacterStyle ); + rView.InsertCaption( &aOpt ); +} + +IMPL_LINK_INLINE_START( SwCaptionDialog, OptionHdl, Button*, pButton ) +{ + String sFldTypeName = aCategoryBox.GetText(); + if(sFldTypeName == sNone) + sFldTypeName = aEmptyStr; + SwSequenceOptionDialog aDlg( pButton, rView, sFldTypeName ); + aDlg.SetApplyBorderAndShadow(bCopyAttributes); + aDlg.SetCharacterStyle( sCharacterStyle ); + aDlg.SetOrderNumberingFirst( bOrderNumberingFirst ); + aDlg.Execute(); + bCopyAttributes = aDlg.IsApplyBorderAndShadow(); + sCharacterStyle = aDlg.GetCharacterStyle(); + //#i61007# order of captions + if( bOrderNumberingFirst != aDlg.IsOrderNumberingFirst() ) + { + bOrderNumberingFirst = aDlg.IsOrderNumberingFirst(); + SW_MOD()->GetModuleConfig()->SetCaptionOrderNumberingFirst(bOrderNumberingFirst); + ApplyCaptionOrder(); + } + DrawSample(); + return 0; +} +IMPL_LINK_INLINE_END( SwCaptionDialog, OptionHdl, Button*, EMPTYARG ) + +IMPL_LINK_INLINE_START( SwCaptionDialog, SelectHdl, ListBox *, EMPTYARG ) +{ + DrawSample(); + return 0; +} +IMPL_LINK_INLINE_END( SwCaptionDialog, SelectHdl, ListBox *, EMPTYARG ) + + + +IMPL_LINK( SwCaptionDialog, ModifyHdl, Edit *, EMPTYARG ) +{ + SwWrtShell &rSh = rView.GetWrtShell(); + String sFldTypeName = aCategoryBox.GetText(); + sal_Bool bCorrectFldName = sFldTypeName.Len() > 0; + sal_Bool bNone = sFldTypeName == sNone; + SwFieldType* pType = (bCorrectFldName && !bNone) + ? rSh.GetFldType( RES_SETEXPFLD, sFldTypeName ) + : 0; + aOKButton.Enable( bCorrectFldName && + (!pType || + ((SwSetExpFieldType*)pType)->GetType() == nsSwGetSetExpType::GSE_SEQ) + && 0 != sFldTypeName.Len() ); + aOptionButton.Enable( aOKButton.IsEnabled() && !bNone ); + aFormatText.Enable( !bNone ); + aFormatBox.Enable( !bNone ); + aSepText.Enable( !bNone ); + aSepEdit.Enable( !bNone ); + DrawSample(); + return 0; +} + +IMPL_LINK(SwCaptionDialog, CaptionHdl, PushButton*, EMPTYARG) +{ + SfxItemSet aSet( rView.GetDocShell()->GetDoc()->GetAttrPool() ); + SwCaptionOptDlg aDlg( this, aSet ); + aDlg.Execute(); + + return 0; +} + +void SwCaptionDialog::DrawSample() +{ + String aStr; + String sCaption = aTextEdit.GetText(); + + // Nummer + String sFldTypeName = aCategoryBox.GetText(); + sal_Bool bNone = sFldTypeName == sNone; + if( !bNone ) + { + sal_uInt16 nNumFmt = (sal_uInt16)(sal_uIntPtr)aFormatBox.GetEntryData( + aFormatBox.GetSelectEntryPos() ); + if( SVX_NUM_NUMBER_NONE != nNumFmt ) + { + // Kategorie + //#i61007# order of captions + if( !bOrderNumberingFirst ) + { + aStr += sFldTypeName; + if ( aStr.Len() > 0 ) + aStr += ' '; + } + + SwWrtShell &rSh = rView.GetWrtShell(); + SwSetExpFieldType* pFldType = (SwSetExpFieldType*)rSh.GetFldType( + RES_SETEXPFLD, sFldTypeName ); + if( pFldType && pFldType->GetOutlineLvl() < MAXLEVEL ) + { + sal_Int8 nLvl = pFldType->GetOutlineLvl(); + SwNumberTree::tNumberVector aNumVector; + for( sal_Int8 i = 0; i <= nLvl; ++i ) + aNumVector.push_back(1); + + String sNumber( rSh.GetOutlineNumRule()-> + MakeNumString(aNumVector, sal_False )); + if( sNumber.Len() ) + (aStr += sNumber) += pFldType->GetDelimiter(); + } + + switch( nNumFmt ) + { + case SVX_NUM_CHARS_UPPER_LETTER: aStr += 'A'; break; + case SVX_NUM_CHARS_UPPER_LETTER_N: aStr += 'A'; break; + case SVX_NUM_CHARS_LOWER_LETTER: aStr += 'a'; break; + case SVX_NUM_CHARS_LOWER_LETTER_N: aStr += 'a'; break; + case SVX_NUM_ROMAN_UPPER: aStr += 'I'; break; + case SVX_NUM_ROMAN_LOWER: aStr += 'i'; break; + //case ARABIC: + default: aStr += '1'; break; + } + //#i61007# order of captions + if( bOrderNumberingFirst ) + { + aStr += aNumberingSeparatorED.GetText(); + aStr += sFldTypeName; + } + + } + if( sCaption.Len() > 0 ) + { + aStr += aSepEdit.GetText(); + } + } + aStr += sCaption; + // do preview! + aPrevWin.SetPreviewText( aStr ); +} + +void SwCaptionDialog::CheckButtonWidth() +{ + // check if the text of the AutoCaption button is to wide + const long nOffset = 10; + String sText = aAutoCaptionButton.GetText(); + long nTxtW = aAutoCaptionButton.GetTextWidth( sText ); + if ( sText.Search( '~' ) == STRING_NOTFOUND ) + nTxtW += nOffset; + long nBtnW = aAutoCaptionButton.GetSizePixel().Width(); + if ( nTxtW > nBtnW ) + { + // then broaden all buttons + Size aNewSize; + long nDelta = Max( ( nTxtW - nBtnW ), nOffset ); + Button* pBtns[] = + { + &aOKButton, &aCancelButton, &aHelpButton, &aAutoCaptionButton, &aOptionButton + }; + Button** pCurrent = pBtns; + for ( sal_uInt32 i = 0; i < sizeof( pBtns ) / sizeof( pBtns[ 0 ] ); ++i, ++pCurrent ) + { + aNewSize = (*pCurrent)->GetSizePixel(); + aNewSize.Width() += nDelta; + (*pCurrent)->SetSizePixel( aNewSize ); + } + // and the dialog + aNewSize = GetOutputSizePixel(); + aNewSize.Width() += nDelta; + SetOutputSizePixel( aNewSize ); + } +} + +SwCaptionDialog::~SwCaptionDialog() +{ + delete pMgr; +} +/* */ + + +SwSequenceOptionDialog::SwSequenceOptionDialog( Window *pParent, SwView &rV, + const String& rSeqFldType ) + : SvxStandardDialog( pParent, SW_RES(DLG_SEQUENCE_OPTION) ), + aFlHeader (this, SW_RES(FL_HEADER )), + aFtLevel (this, SW_RES(FT_LEVEL )), + aLbLevel (this, SW_RES(LB_LEVEL )), + aFtDelim (this, SW_RES(FT_SEPARATOR )), + aEdDelim (this, SW_RES(ED_SEPARATOR )), + aFlCatAndFrame (this, SW_RES(FL_CATANDFRAME)), + aFtCharStyle (this, SW_RES(FT_CHARSTYLE )), + aLbCharStyle (this, SW_RES(LB_CHARSTYLE )), + aApplyBorderAndShadowCB(this, SW_RES(CB_APPLYBAS)), + aFlCaptionOrder(this, SW_RES( FL_ORDER )), //#i61007# order of captions + aFtCaptionOrder(this, SW_RES( FT_ORDER )), + aLbCaptionOrder(this, SW_RES( LB_ORDER )), + aOKButton (this, SW_RES(BTN_OK )), + aCancelButton (this, SW_RES(BTN_CANCEL )), + aHelpButton (this, SW_RES(BTN_HELP )), + + rView( rV ), + aFldTypeName( rSeqFldType ) +{ + FreeResource(); + SwWrtShell &rSh = rView.GetWrtShell(); + + for( sal_uInt16 n = 0; n < MAXLEVEL; ++n ) + aLbLevel.InsertEntry( String::CreateFromInt32(n+1) ); + + SwSetExpFieldType* pFldType = (SwSetExpFieldType*)rSh.GetFldType( + RES_SETEXPFLD, aFldTypeName ); + + sal_Unicode nLvl = MAXLEVEL; + String sDelim( String::CreateFromAscii( ": " ) ); + if( pFldType ) + { + sDelim = pFldType->GetDelimiter(); + nLvl = pFldType->GetOutlineLvl(); + } + + aLbLevel.SelectEntryPos( nLvl < MAXLEVEL ? nLvl + 1 : 0 ); + aEdDelim.SetText( sDelim ); + + ::FillCharStyleListBox( aLbCharStyle, rView.GetDocShell(), sal_True, sal_True ); + aLbCharStyle.SelectEntryPos( 0 ); +} + +SwSequenceOptionDialog::~SwSequenceOptionDialog() +{ +} + +void SwSequenceOptionDialog::Apply() +{ + SwWrtShell &rSh = rView.GetWrtShell(); + SwSetExpFieldType* pFldType = (SwSetExpFieldType*)rSh.GetFldType( + RES_SETEXPFLD, aFldTypeName ); + + sal_Int8 nLvl = (sal_Int8)( aLbLevel.GetSelectEntryPos() - 1); + sal_Unicode cDelim = aEdDelim.GetText().GetChar(0); + + sal_Bool bUpdate = sal_True; + if( pFldType ) + { + pFldType->SetDelimiter( cDelim ); + pFldType->SetOutlineLvl( nLvl ); + } + else if( aFldTypeName.Len() && nLvl < MAXLEVEL ) + { + // dann muessen wir das mal einfuegen + SwSetExpFieldType aFldType( rSh.GetDoc(), aFldTypeName, nsSwGetSetExpType::GSE_SEQ ); + aFldType.SetDelimiter( cDelim ); + aFldType.SetOutlineLvl( nLvl ); + rSh.InsertFldType( aFldType ); + } + else + bUpdate = sal_False; + + if( bUpdate ) + rSh.UpdateExpFlds(); +} + +/*-- 24.08.2004 16:13:53--------------------------------------------------- + + -----------------------------------------------------------------------*/ +String SwSequenceOptionDialog::GetCharacterStyle() const +{ + String sRet; + if(aLbCharStyle.GetSelectEntryPos()) + sRet = aLbCharStyle.GetSelectEntry(); + return sRet; +} + +/*-- 24.08.2004 16:14:00--------------------------------------------------- + + -----------------------------------------------------------------------*/ +void SwSequenceOptionDialog::SetCharacterStyle(const String& rStyle) +{ + aLbCharStyle.SelectEntryPos(0); + aLbCharStyle.SelectEntry(rStyle); +} + +long SwCaptionDialog::CategoryBox::PreNotify( NotifyEvent& rNEvt ) +{ + long nHandled = 0; + if( rNEvt.GetType() == EVENT_KEYINPUT && + rNEvt.GetKeyEvent()->GetCharCode() ) + { + const KeyEvent* pEvent = rNEvt.GetKeyEvent(); + const KeyCode& rKeyCode = pEvent->GetKeyCode(); + sal_uInt16 nTmpCode = rKeyCode.GetFullCode() & ~KEY_ALLMODTYPE; + + if(nTmpCode != KEY_BACKSPACE && nTmpCode != KEY_RETURN + && nTmpCode != KEY_TAB && nTmpCode != KEY_ESCAPE) + { + String sKey( pEvent->GetCharCode() ), sName( GetText() ); + Selection aSel( GetSelection() ); + aSel.Justify(); + if( aSel.Len() ) + sName.Erase( (xub_StrLen)aSel.Min(), (xub_StrLen)aSel.Len() ); + sName.Insert( sKey, (xub_StrLen)aSel.Min() ); + if( !SwCalc::IsValidVarName( sName )) + nHandled = 1; + } + } + if(!nHandled) + nHandled = ComboBox::PreNotify( rNEvt ); + return nHandled; +} +/*-- 01.11.2007 10:45:51--------------------------------------------------- + //#i61007# order of captions + -----------------------------------------------------------------------*/ +void lcl_MoveH( Window& rWin, sal_Int32 nMove ) +{ + Point aPos( rWin.GetPosPixel() ); + aPos.Y() += nMove; + rWin.SetPosPixel(aPos); +} +void SwCaptionDialog::ApplyCaptionOrder() +{ + //have the settings changed? + bool bVisible = aNumberingSeparatorED.IsVisible() != 0; + if( bOrderNumberingFirst != bVisible ) + { + sal_Int32 nDiff = aPosBox.GetPosPixel().Y() - aSepEdit.GetPosPixel().Y(); + + aNumberingSeparatorFT.Show( bOrderNumberingFirst ); + aNumberingSeparatorED.Show( bOrderNumberingFirst ); + if( !bOrderNumberingFirst ) + { + nDiff = -nDiff; + } + lcl_MoveH( aCategoryText, 2 * nDiff); + lcl_MoveH( aFormatText, -nDiff ); + lcl_MoveH( aFormatBox, -nDiff ); + lcl_MoveH( aCategoryBox, 2 * nDiff); + lcl_MoveH( aSepText, nDiff ); + lcl_MoveH( aSepEdit, nDiff ); + lcl_MoveH( aPosText, nDiff ); + lcl_MoveH( aPosBox, nDiff ); + lcl_MoveH( aPrevWin, nDiff ); + Size aDlgSize( GetSizePixel() ); + aDlgSize.Height() += nDiff; + SetSizePixel( aDlgSize ); + } +} diff --git a/sw/source/ui/frmdlg/cption.hrc b/sw/source/ui/frmdlg/cption.hrc new file mode 100644 index 000000000000..1487171f0c01 --- /dev/null +++ b/sw/source/ui/frmdlg/cption.hrc @@ -0,0 +1,78 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _CPTION_HRC +#define _CPTION_HRC + +#define BTN_OK 1 +#define BTN_CANCEL 2 +#define TXT_SAMPLE 3 +#define TXT_CATEGORY 4 +#define BOX_CATEGORY 5 +#define TXT_FORMAT 6 +#define BOX_FORMAT 7 +#define TXT_TEXT 8 +#define EDT_TEXT 9 +#define TXT_POS 10 +#define BOX_POS 11 +#define FL_SETTINGS 12 +#define BTN_HELP 13 +#define BTN_OPTION 14 +#define FL_HEADER 15 +#define FT_LEVEL 16 +#define LB_LEVEL 17 +#define FT_SEPARATOR 18 +#define ED_SEPARATOR 19 +#define CB_COPY_ATTR 20 +#define FT_OBJECT_NAME 21 +#define ED_OBJECT_NAME 22 +#define BTN_AUTOCAPTION 23 +#define TXT_SEP 24 +#define EDT_SEP 25 +#define WIN_SAMPLE 26 + +#define FL_CATANDFRAME 27 +#define FT_CHARSTYLE 28 +#define LB_CHARSTYLE 29 +#define CB_APPLYBAS 30 +#define FL_ORDER 31 +#define FT_ORDER 32 +#define LB_ORDER 33 + +#define FT_NUM_SEP 34 +#define ED_NUM_SEP 35 + +#define STR_BEGINNING 1 +#define STR_END 2 +#define STR_ABOVE 3 +#define STR_CP_BELOW 4 +#define STR_CATEGORY_NONE 5 + +#endif + +// ********************************************************************** EOF + diff --git a/sw/source/ui/frmdlg/cption.src b/sw/source/ui/frmdlg/cption.src new file mode 100644 index 000000000000..c93efab586f1 --- /dev/null +++ b/sw/source/ui/frmdlg/cption.src @@ -0,0 +1,342 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + // #include ***************************************************************** +#include "helpid.h" +#include "frmui.hrc" +#include "cption.hrc" +#include "cmdid.h" + // #pragma ****************************************************************** + + // ModalDialog ************************************************************** +ModalDialog DLG_CAPTION +{ + HelpID = HID_DLG_CAPTION ; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 250 , 143 ) ; + Text [ en-US ] = "Caption" ; + Moveable = TRUE ; + OKButton BTN_OK + { + DefButton = TRUE ; + Pos = MAP_APPFONT ( 194 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 194 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 194 , 43 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + PushButton BTN_AUTOCAPTION + { + HelpID = "sw:PushButton:DLG_CAPTION:BTN_AUTOCAPTION"; + Pos = MAP_APPFONT ( 194 , 63 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "AutoCaption..." ; + }; + PushButton BTN_OPTION + { + HelpID = "sw:PushButton:DLG_CAPTION:BTN_OPTION"; + Pos = MAP_APPFONT ( 194 , 80 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Options..." ; + }; + + FixedText TXT_TEXT + { + Pos = MAP_APPFONT ( 6 , 6 ) ; + Size = MAP_APPFONT ( 182 , 8 ) ; + Text [ en-US ] = "Caption" ; + Left = TRUE ; + }; + Edit EDT_TEXT + { + HelpID = "sw:Edit:DLG_CAPTION:EDT_TEXT"; + Pos = MAP_APPFONT ( 6 , 17 ) ; + Size = MAP_APPFONT ( 182 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Left = TRUE ; + }; + FixedLine FL_SETTINGS + { + Pos = MAP_APPFONT ( 6 , 35 ) ; + Size = MAP_APPFONT ( 182 , 8 ) ; + Text [ en-US ] = "Properties"; + }; + FixedText TXT_CATEGORY + { + Pos = MAP_APPFONT ( 12 , 49 ) ; + Size = MAP_APPFONT ( 67 , 8 ) ; + Text [ en-US ] = "Category" ; + Left = TRUE ; + }; + ComboBox BOX_CATEGORY + { + HelpID = "sw:ComboBox:DLG_CAPTION:BOX_CATEGORY"; + Pos = MAP_APPFONT ( 82 , 46 ) ; + Size = MAP_APPFONT ( 106 , 61 ) ; + DropDown = TRUE ; + TabStop = TRUE ; + Sort = TRUE ; + }; + FixedText TXT_FORMAT + { + Pos = MAP_APPFONT ( 12 , 66 ) ; + Size = MAP_APPFONT ( 67 , 8 ) ; + Text [ en-US ] = "Numbering" ; + Left = TRUE ; + }; + ListBox BOX_FORMAT + { + HelpID = "sw:ListBox:DLG_CAPTION:BOX_FORMAT"; + Border = TRUE ; + Pos = MAP_APPFONT ( 82 , 63 ) ; + Size = MAP_APPFONT ( 106 , 83 ) ; + DropDown = TRUE ; + TabStop = TRUE ; + }; + FixedText FT_NUM_SEP + { + Pos = MAP_APPFONT ( 12 , 66 ) ; + Size = MAP_APPFONT ( 67 , 8 ) ; + Text [ en-US ] = "Numbering separator" ; + Left = TRUE ; + Hide = TRUE; + }; + Edit ED_NUM_SEP + { + HelpID = "sw:Edit:DLG_CAPTION:ED_NUM_SEP"; + Pos = MAP_APPFONT ( 82 , 63 ) ; + Size = MAP_APPFONT ( 106 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Left = TRUE ; + Text = ". " ; + Hide = TRUE; + }; + FixedText TXT_SEP + { + Pos = MAP_APPFONT ( 12 , 82 ) ; + Size = MAP_APPFONT ( 67 , 8 ) ; + Text [ en-US ] = "Separator" ; + Left = TRUE ; + }; + Edit EDT_SEP + { + HelpID = "sw:Edit:DLG_CAPTION:EDT_SEP"; + Pos = MAP_APPFONT ( 82 , 80 ) ; + Size = MAP_APPFONT ( 106 , 12 ) ; + Border = TRUE ; + TabStop = TRUE ; + Left = TRUE ; + Text [ en-US ] = ": " ; + }; + FixedText TXT_POS + { + Pos = MAP_APPFONT ( 12 , 100 ) ; + Size = MAP_APPFONT ( 67 , 8 ) ; + Left = TRUE ; + Text [ en-US ] = "Position" ; + }; + ListBox BOX_POS + { + HelpID = "sw:ListBox:DLG_CAPTION:BOX_POS"; + Pos = MAP_APPFONT ( 82 , 97 ) ; + Size = MAP_APPFONT ( 106 , 61 ) ; + DropDown = TRUE ; + TabStop = TRUE ; + Border = TRUE ; + }; + Window WIN_SAMPLE + { + Pos = MAP_APPFONT ( 6 , 117 ) ; + Size = MAP_APPFONT ( 182 , 20 ) ; + Border = TRUE ; + }; + + String STR_BEGINNING + { + Text [ en-US ] = "Above" ; + }; + String STR_END + { + Text [ en-US ] = "Below" ; + }; + String STR_ABOVE + { + Text [ en-US ] = "Above" ; + }; + String STR_CP_BELOW + { + Text [ en-US ] = "Below" ; + }; + String STR_CATEGORY_NONE + { + Text [ en-US ] = "<None>" ; + }; +}; + +ModalDialog DLG_SEQUENCE_OPTION +{ + HelpID = HID_DLG_SEQUENCE_OPTION ; + OutputSize = TRUE ; + SVLook = TRUE ; + Size = MAP_APPFONT ( 200 , 132 ) ; + Moveable = TRUE ; + Text [ en-US ] = "Options" ; + OKButton BTN_OK + { + DefButton = TRUE ; + Pos = MAP_APPFONT ( 145 , 6 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + CancelButton BTN_CANCEL + { + Pos = MAP_APPFONT ( 145 , 23 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + HelpButton BTN_HELP + { + Pos = MAP_APPFONT ( 145 , 43 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + }; + FixedLine FL_HEADER + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 132 , 8 ) ; + Text [ en-US ] = "Numbering captions by chapter" ; + }; + FixedText FT_LEVEL + { + Pos = MAP_APPFONT ( 12 , 21 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "~Level" ; + }; + ListBox LB_LEVEL + { + HelpID = "sw:ListBox:DLG_SEQUENCE_OPTION:LB_LEVEL"; + Border = TRUE ; + Pos = MAP_APPFONT ( 65 , 18 ) ; + Size = MAP_APPFONT ( 72 , 60 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "<None>" ; > ; + }; + }; + FixedText FT_SEPARATOR + { + Pos = MAP_APPFONT ( 12 , 33 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "~Separator" ; + }; + Edit ED_SEPARATOR + { + HelpID = "sw:Edit:DLG_SEQUENCE_OPTION:ED_SEPARATOR"; + Pos = MAP_APPFONT ( 65 , 34 ) ; + Size = MAP_APPFONT ( 72 , 12 ) ; + Border = TRUE ; + MaxTextLength = 1 ; + TEXT = "." ; + }; + FixedLine FL_CATANDFRAME + { + Pos = MAP_APPFONT ( 6 , 53 ) ; + Size = MAP_APPFONT ( 132 , 8 ) ; + Text [ en-US ] = "Category and frame format" ; + }; + FixedText FT_CHARSTYLE + { + Pos = MAP_APPFONT ( 12 , 71 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "Character style" ; + }; + ListBox LB_CHARSTYLE + { + HelpID = "sw:ListBox:DLG_SEQUENCE_OPTION:LB_CHARSTYLE"; + Border = TRUE ; + Pos = MAP_APPFONT ( 65 , 68 ) ; + Size = MAP_APPFONT ( 72 , 60 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "<None>" ; > ; + }; + }; + CheckBox CB_APPLYBAS + { + HelpID = "sw:CheckBox:DLG_SEQUENCE_OPTION:CB_APPLYBAS"; + Pos = MAP_APPFONT ( 12 , 84 ) ; + Size = MAP_APPFONT ( 136 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Apply border and shadow"; + }; + FixedLine FL_ORDER + { + Pos = MAP_APPFONT ( 6 , 97 ) ; + Size = MAP_APPFONT ( 132 , 8 ) ; + Text [ en-US ] = "Caption" ; + }; + FixedText FT_ORDER + { + Pos = MAP_APPFONT ( 12 , 115 ) ; + Size = MAP_APPFONT ( 50 , 8 ) ; + Text [ en-US ] = "Caption order" ; + }; + ListBox LB_ORDER + { + HelpID = "sw:ListBox:DLG_SEQUENCE_OPTION:LB_ORDER"; + Border = TRUE ; + Pos = MAP_APPFONT ( 65 , 114 ) ; + Size = MAP_APPFONT ( 72 , 60 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + StringList [ en-US ] = + { + < "Category first" ; > ; + < "Numbering first" ; > ; + }; + }; +}; + // ********************************************************************** EOF + diff --git a/sw/source/ui/frmdlg/frmdlg.cxx b/sw/source/ui/frmdlg/frmdlg.cxx new file mode 100644 index 000000000000..f25d8186b83e --- /dev/null +++ b/sw/source/ui/frmdlg/frmdlg.cxx @@ -0,0 +1,221 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + +#include <svx/dialogs.hrc> +#include <hintids.hxx> +#include <tools/list.hxx> +#include <sfx2/viewfrm.hxx> +#include <svx/htmlmode.hxx> +#include <fmtfsize.hxx> +#include <wrtsh.hxx> +#ifndef _VIEW_HXX +#include <view.hxx> +#endif +#include <docsh.hxx> +#include <viewopt.hxx> +#include <frmdlg.hxx> +#include <frmpage.hxx> +#include <wrap.hxx> +#include <column.hxx> +#include <macassgn.hxx> + +#ifndef _FRMUI_HRC +#include <frmui.hrc> +#endif +#ifndef _GLOBALS_HRC +#include <globals.hrc> +#endif +#include <svx/svxids.hrc> +#include <svx/flagsdef.hxx> +#include <svx/svxdlg.hxx> + +/*-------------------------------------------------------------------- + Beschreibung: Der Traeger des Dialoges + --------------------------------------------------------------------*/ + +SwFrmDlg::SwFrmDlg( SfxViewFrame* pViewFrame, + Window* pParent, + const SfxItemSet& rCoreSet, + sal_Bool bNewFrm, + sal_uInt16 nResType, + sal_Bool bFormat, + sal_uInt16 nDefPage, + const String* pStr) : + + SfxTabDialog(pViewFrame, pParent, SW_RES(nResType), &rCoreSet, pStr != 0), + m_bFormat(bFormat), + m_bNew(bNewFrm), + m_rSet(rCoreSet), + m_nDlgType(nResType), + m_pWrtShell(((SwView*)pViewFrame->GetViewShell())->GetWrtShellPtr()) +{ + FreeResource(); + sal_uInt16 nHtmlMode = ::GetHtmlMode(m_pWrtShell->GetView().GetDocShell()); + m_bHTMLMode = static_cast< sal_Bool >(nHtmlMode & HTMLMODE_ON); + + // BspFont fuer beide Bsp-TabPages + // + if(pStr) + { + String aTmp( GetText() ); + aTmp += SW_RESSTR(STR_COLL_HEADER); + aTmp += *pStr; + aTmp += ')'; + } + + AddTabPage(TP_FRM_STD, SwFrmPage::Create, 0); + AddTabPage(TP_FRM_ADD, SwFrmAddPage::Create, 0); + AddTabPage(TP_FRM_WRAP, SwWrapTabPage::Create, 0); + AddTabPage(TP_FRM_URL, SwFrmURLPage::Create, 0); + if(m_nDlgType == DLG_FRM_GRF) + { + AddTabPage( TP_GRF_EXT, SwGrfExtPage::Create, 0 ); + AddTabPage( RID_SVXPAGE_GRFCROP ); + } + if (m_nDlgType == DLG_FRM_STD) + { + AddTabPage(TP_COLUMN, SwColumnPage::Create, 0); + } + SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!"); + AddTabPage(TP_BACKGROUND, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ), 0 ); + AddTabPage( TP_MACRO_ASSIGN, pFact->GetTabPageCreatorFunc(RID_SVXPAGE_MACROASSIGN), 0); + AddTabPage( TP_BORDER, pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ), 0 ); + + if(m_bHTMLMode) + { + switch( m_nDlgType ) + { + case DLG_FRM_STD: + if(0 == (nHtmlMode & HTMLMODE_SOME_ABS_POS)) + RemoveTabPage(TP_BORDER); + RemoveTabPage(TP_COLUMN); + // kein break + case DLG_FRM_OLE: + RemoveTabPage(TP_FRM_URL); + RemoveTabPage(TP_MACRO_ASSIGN); + break; + case DLG_FRM_GRF: + RemoveTabPage(RID_SVXPAGE_GRFCROP); + break; + } + if( 0 == (nHtmlMode & HTMLMODE_SOME_ABS_POS) || + m_nDlgType != DLG_FRM_STD ) + RemoveTabPage(TP_BACKGROUND); + } + + if (m_bNew) + SetCurPageId(TP_FRM_STD); + + if (nDefPage) + SetCurPageId(nDefPage); +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +SwFrmDlg::~SwFrmDlg() +{ +} + + + + +void SwFrmDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) +{ + SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); + switch ( nId ) + { + case TP_FRM_STD: + ((SwFrmPage&)rPage).SetNewFrame(m_bNew); + ((SwFrmPage&)rPage).SetFormatUsed(m_bFormat); + ((SwFrmPage&)rPage).SetFrmType(m_nDlgType); + break; + + case TP_FRM_ADD: + ((SwFrmAddPage&)rPage).SetFormatUsed(m_bFormat); + ((SwFrmAddPage&)rPage).SetFrmType(m_nDlgType); + ((SwFrmAddPage&)rPage).SetNewFrame(m_bNew); + ((SwFrmAddPage&)rPage).SetShell(m_pWrtShell); + break; + + case TP_FRM_WRAP: + ((SwWrapTabPage&)rPage).SetNewFrame(m_bNew); + ((SwWrapTabPage&)rPage).SetFormatUsed(m_bFormat, sal_False); + ((SwWrapTabPage&)rPage).SetShell(m_pWrtShell); + break; + + case TP_COLUMN: + { + ((SwColumnPage&)rPage).SetFrmMode(sal_True); + ((SwColumnPage&)rPage).SetFormatUsed(m_bFormat); + + const SwFmtFrmSize& rSize = (const SwFmtFrmSize&) + m_rSet.Get( RES_FRM_SIZE ); + ((SwColumnPage&)rPage).SetPageWidth( rSize.GetWidth() ); + } + break; + + case TP_MACRO_ASSIGN: + { + SfxAllItemSet aNewSet(*aSet.GetPool()); + aNewSet.Put( SwMacroAssignDlg::AddEvents( + DLG_FRM_GRF == m_nDlgType ? MACASSGN_GRAPHIC : DLG_FRM_OLE == m_nDlgType ? MACASSGN_OLE : MACASSGN_FRMURL ) ); + if ( m_pWrtShell ) + rPage.SetFrame( m_pWrtShell->GetView().GetViewFrame()->GetFrame().GetFrameInterface() ); + rPage.PageCreated(aNewSet); + break; + } + + case TP_BACKGROUND: + if( DLG_FRM_STD == m_nDlgType ) + { + sal_Int32 nFlagType = SVX_SHOW_SELECTOR; + if(!m_bHTMLMode) + nFlagType |= SVX_ENABLE_TRANSPARENCY; + aSet.Put (SfxUInt32Item(SID_FLAG_TYPE, nFlagType)); + rPage.PageCreated(aSet); + } + break; + + case TP_BORDER: + { + aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,SW_BORDER_MODE_FRAME)); + rPage.PageCreated(aSet); + } + break; + } +} + diff --git a/sw/source/ui/frmdlg/frmmgr.cxx b/sw/source/ui/frmdlg/frmmgr.cxx new file mode 100644 index 000000000000..dd709b8243d4 --- /dev/null +++ b/sw/source/ui/frmdlg/frmmgr.cxx @@ -0,0 +1,629 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#include "cmdid.h" +#include "hintids.hxx" + +#include <svl/stritem.hxx> +#include <editeng/protitem.hxx> +#include <editeng/boxitem.hxx> +#include <editeng/opaqitem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/ulspitem.hxx> +#include <editeng/shaditem.hxx> +#include <svx/swframevalidation.hxx> +#include <fmtclds.hxx> +#include "wrtsh.hxx" +#include "view.hxx" +#include "viewopt.hxx" +#include "uitool.hxx" +#include "frmmgr.hxx" +#include "format.hxx" +#include "mdiexp.hxx" +#include "poolfmt.hxx" +#include <com/sun/star/text/TextContentAnchorType.hpp> +#include <com/sun/star/text/HoriOrientation.hpp> +#include <com/sun/star/text/VertOrientation.hpp> +#include <com/sun/star/text/RelOrientation.hpp> + +using namespace ::com::sun::star; +//using namespace text; + +static sal_uInt16 __FAR_DATA aFrmMgrRange[] = { + RES_FRMATR_BEGIN, RES_FRMATR_END-1, + SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, + FN_SET_FRM_NAME, FN_SET_FRM_NAME, + 0}; + +/*-------------------------------------------------------------------- + Beschreibung: Rahmen-Attribute ueber Shell ermitteln + --------------------------------------------------------------------*/ + +SwFlyFrmAttrMgr::SwFlyFrmAttrMgr( sal_Bool bNew, SwWrtShell* pSh, sal_uInt8 nType ) : + aSet( (SwAttrPool&)pSh->GetAttrPool(), aFrmMgrRange ), + pOwnSh( pSh ), + bAbsPos( sal_False ), + bNewFrm( bNew ), + bIsInVertical( sal_False ), + bIsInVerticalL2R( sal_False ) +{ + if ( bNewFrm ) + { + // Defaults einstellen: + sal_uInt16 nId = 0; + switch ( nType ) + { + case FRMMGR_TYPE_TEXT: nId = RES_POOLFRM_FRAME; break; + case FRMMGR_TYPE_OLE: nId = RES_POOLFRM_OLE; break; + case FRMMGR_TYPE_GRF: nId = RES_POOLFRM_GRAPHIC; break; + } + aSet.SetParent( &pOwnSh->GetFmtFromPool( nId )->GetAttrSet()); + aSet.Put( SwFmtFrmSize( ATT_MIN_SIZE, DFLT_WIDTH, DFLT_HEIGHT )); + if ( 0 != ::GetHtmlMode(pSh->GetView().GetDocShell()) ) + aSet.Put( SwFmtHoriOrient( 0, text::HoriOrientation::LEFT, text::RelOrientation::PRINT_AREA ) ); + } + else if ( nType == FRMMGR_TYPE_NONE ) + { + pOwnSh->GetFlyFrmAttr( aSet ); + sal_Bool bRightToLeft; + bIsInVertical = pOwnSh->IsFrmVertical(sal_True, bRightToLeft, bIsInVerticalL2R); + } + ::PrepareBoxInfo( aSet, *pOwnSh ); +} + +SwFlyFrmAttrMgr::SwFlyFrmAttrMgr( sal_Bool bNew, SwWrtShell* pSh, const SfxItemSet &rSet ) : + aSet( rSet ), + pOwnSh( pSh ), + bAbsPos( sal_False ), + bNewFrm( bNew ), + bIsInVertical(sal_False), + bIsInVerticalL2R(sal_False) +{ + if(!bNew) + { + sal_Bool bRightToLeft; + bIsInVertical = pSh->IsFrmVertical(sal_True, bRightToLeft, bIsInVerticalL2R); + } +} + + +/*-------------------------------------------------------------------- + Beschreibung: Initialisieren + --------------------------------------------------------------------*/ + +void SwFlyFrmAttrMgr::UpdateAttrMgr() +{ + if ( !bNewFrm && pOwnSh->IsFrmSelected() ) + pOwnSh->GetFlyFrmAttr( aSet ); + ::PrepareBoxInfo( aSet, *pOwnSh ); +} + +void SwFlyFrmAttrMgr::_UpdateFlyFrm() +{ + const SfxPoolItem* pItem = 0; + + if (aSet.GetItemState(FN_SET_FRM_NAME, sal_False, &pItem) == SFX_ITEM_SET) + pOwnSh->SetFlyName(((SfxStringItem *)pItem)->GetValue()); + + pOwnSh->SetModified(); + + if ( bAbsPos ) + { + pOwnSh->SetFlyPos( aAbsPos ); + bAbsPos = sal_False; + } +} + +/*-------------------------------------------------------------------- + Beschreibung: Bestehenden Fly-Frame aendern + --------------------------------------------------------------------*/ + +void SwFlyFrmAttrMgr::UpdateFlyFrm() +{ + ASSERT( pOwnSh->IsFrmSelected(), + "Kein Rahmen selektiert oder keine Shell, Update nicht moeglich"); + + if( pOwnSh->IsFrmSelected() ) + { + //JP 6.8.2001: set never an invalid anchor into the core. + const SfxPoolItem *pGItem, *pItem; + if( SFX_ITEM_SET == aSet.GetItemState( RES_ANCHOR, sal_False, &pItem )) + { + SfxItemSet aGetSet( *aSet.GetPool(), RES_ANCHOR, RES_ANCHOR ); + if( pOwnSh->GetFlyFrmAttr( aGetSet ) && 1 == aGetSet.Count() && + SFX_ITEM_SET == aGetSet.GetItemState( RES_ANCHOR, sal_False, &pGItem ) + && ((SwFmtAnchor*)pGItem)->GetAnchorId() == + ((SwFmtAnchor*)pItem)->GetAnchorId() ) + aSet.ClearItem( RES_ANCHOR ); + } + + // return wg. BASIC + if( aSet.Count() ) + { + pOwnSh->StartAllAction(); + pOwnSh->SetFlyFrmAttr( aSet ); + _UpdateFlyFrm(); + pOwnSh->EndAllAction(); + } + } +} + +/*-------------------------------------------------------------------- + Beschreibung: Rahmen einfuegen + --------------------------------------------------------------------*/ + +sal_Bool SwFlyFrmAttrMgr::InsertFlyFrm() +{ + pOwnSh->StartAllAction(); + + sal_Bool bRet = 0 != pOwnSh->NewFlyFrm( aSet ); + + // richtigen Mode an der Shell einschalten, Rahmen wurde aut. selektiert. + if ( bRet ) + { + _UpdateFlyFrm(); + pOwnSh->EnterSelFrmMode(); + FrameNotify(pOwnSh, FLY_DRAG_START); + } + pOwnSh->EndAllAction(); + return bRet; +} + +/*------------------------------------------------------------------------ + Beschreibung: Rahmen des Typs eAnchorType einfuegen. Position und + Groesse werden explizit angegeben. + Nicht erlaubte Werte des Aufzaehlungstypes werden + korrigiert. +------------------------------------------------------------------------*/ + +void SwFlyFrmAttrMgr::InsertFlyFrm(RndStdIds eAnchorType, + const Point &rPos, + const Size &rSize, + sal_Bool bAbs ) +{ + ASSERT( eAnchorType == FLY_AT_PAGE || + eAnchorType == FLY_AT_PARA || + eAnchorType == FLY_AT_CHAR || + eAnchorType == FLY_AT_FLY || + eAnchorType == FLY_AS_CHAR, "invalid frame type" ); + + if ( bAbs ) + SetAbsPos( rPos ); + else + SetPos( rPos ); + + SetSize( rSize ); + SetAnchor( eAnchorType ); + InsertFlyFrm(); +} + +/*-------------------------------------------------------------------- + Beschreibung: Anker setzen + --------------------------------------------------------------------*/ + +void SwFlyFrmAttrMgr::SetAnchor( RndStdIds eId ) +{ + sal_uInt16 nPhyPageNum, nVirtPageNum; + pOwnSh->GetPageNum( nPhyPageNum, nVirtPageNum ); + + aSet.Put( SwFmtAnchor( eId, nPhyPageNum ) ); + if ((FLY_AT_PAGE == eId) || (FLY_AT_PARA == eId) || (FLY_AT_CHAR == eId) + || (FLY_AT_FLY == eId)) + { + SwFmtVertOrient aVertOrient( GetVertOrient() ); + SwFmtHoriOrient aHoriOrient( GetHoriOrient() ); + aHoriOrient.SetRelationOrient( text::RelOrientation::FRAME ); + aVertOrient.SetRelationOrient( text::RelOrientation::FRAME ); + aSet.Put( aVertOrient ); + aSet.Put( aHoriOrient ); + } +} + +/*------------------------------------------------------------------------ + Beschreibung: Setzen des Attributs fuer Spalten +------------------------------------------------------------------------*/ + +void SwFlyFrmAttrMgr::SetCol( const SwFmtCol &rCol ) +{ + aSet.Put( rCol ); +} +/*-------------------------------------------------------------------- + Beschreibung: Absolute Position setzen + --------------------------------------------------------------------*/ + +void SwFlyFrmAttrMgr::SetAbsPos( const Point& rPoint ) +{ + bAbsPos = sal_True; + aAbsPos = rPoint; + + SwFmtVertOrient aVertOrient( GetVertOrient() ); + SwFmtHoriOrient aHoriOrient( GetHoriOrient() ); + aHoriOrient.SetHoriOrient( text::HoriOrientation::NONE ); + aVertOrient.SetVertOrient( text::VertOrientation::NONE ); + aSet.Put( aVertOrient ); + aSet.Put( aHoriOrient ); +} + +/*-------------------------------------------------------------------- + Beschreibung: Metriken auf Korrektheit pruefen + --------------------------------------------------------------------*/ +void SwFlyFrmAttrMgr::ValidateMetrics( SvxSwFrameValidation& rVal, + const SwPosition* pToCharCntntPos, + sal_Bool bOnlyPercentRefValue ) +{ + if (!bOnlyPercentRefValue) + { + rVal.nMinHeight = MINFLY + CalcTopSpace() + CalcBottomSpace(); + rVal.nMinWidth = MINFLY + CalcLeftSpace()+ CalcRightSpace(); + } + + SwRect aBoundRect; + + // OD 18.09.2003 #i18732# - adjustment for allowing vertical position + // aligned to page for fly frame anchored to paragraph or to character. + const RndStdIds eAnchorType = static_cast<RndStdIds >(rVal.nAnchorType); + pOwnSh->CalcBoundRect( aBoundRect, eAnchorType, + rVal.nHRelOrient, + rVal.nVRelOrient, + pToCharCntntPos, + rVal.bFollowTextFlow, + rVal.bMirror, NULL, &rVal.aPercentSize); + + if (bOnlyPercentRefValue) + return; + + // --> OD 2009-09-01 #mongolianlayout# + if ( bIsInVertical || bIsInVerticalL2R ) + // <-- + { + Point aPos(aBoundRect.Pos()); + long nTmp = aPos.X(); + aPos.X() = aPos.Y(); + aPos.Y() = nTmp; + Size aSize(aBoundRect.SSize()); + nTmp = aSize.Width(); + aSize.Width() = aSize.Height(); + aSize.Height() = nTmp; + aBoundRect.Chg( aPos, aSize ); + //exchange width/height to enable correct values + nTmp = rVal.nWidth; + rVal.nWidth = rVal.nHeight; + rVal.nHeight = nTmp; + } + if ((eAnchorType == FLY_AT_PAGE) || (eAnchorType == FLY_AT_FLY)) + { + // MinimalPosition + rVal.nMinHPos = aBoundRect.Left(); + rVal.nMinVPos = aBoundRect.Top(); + SwTwips nH = rVal.nHPos; + SwTwips nV = rVal.nVPos; + + if (rVal.nHPos + rVal.nWidth > aBoundRect.Right()) + { + if (rVal.nHoriOrient == text::HoriOrientation::NONE) + { + rVal.nHPos -= ((rVal.nHPos + rVal.nWidth) - aBoundRect.Right()); + nH = rVal.nHPos; + } + else + rVal.nWidth = aBoundRect.Right() - rVal.nHPos; + } + + if (rVal.nHPos + rVal.nWidth > aBoundRect.Right()) + rVal.nWidth = aBoundRect.Right() - rVal.nHPos; + + if (rVal.nVPos + rVal.nHeight > aBoundRect.Bottom()) + { + if (rVal.nVertOrient == text::VertOrientation::NONE) + { + rVal.nVPos -= ((rVal.nVPos + rVal.nHeight) - aBoundRect.Bottom()); + nV = rVal.nVPos; + } + else + rVal.nHeight = aBoundRect.Bottom() - rVal.nVPos; + } + + if (rVal.nVPos + rVal.nHeight > aBoundRect.Bottom()) + rVal.nHeight = aBoundRect.Bottom() - rVal.nVPos; + + if ( rVal.nVertOrient != text::VertOrientation::NONE ) + nV = aBoundRect.Top(); + + if ( rVal.nHoriOrient != text::HoriOrientation::NONE ) + nH = aBoundRect.Left(); + + rVal.nMaxHPos = aBoundRect.Right() - rVal.nWidth; + rVal.nMaxHeight = aBoundRect.Bottom() - nV; + + rVal.nMaxVPos = aBoundRect.Bottom() - rVal.nHeight; + rVal.nMaxWidth = aBoundRect.Right() - nH; + } + // OD 12.11.2003 #i22341# - handle to character anchored objects vertical + // aligned at character or top of line in a special case + else if ((eAnchorType == FLY_AT_PARA) || + ((eAnchorType == FLY_AT_CHAR) && + !(rVal.nVRelOrient == text::RelOrientation::CHAR) && + !(rVal.nVRelOrient == text::RelOrientation::TEXT_LINE) ) ) + { + if (rVal.nHPos + rVal.nWidth > aBoundRect.Right()) + { + if (rVal.nHoriOrient == text::HoriOrientation::NONE) + { + rVal.nHPos -= ((rVal.nHPos + rVal.nWidth) - aBoundRect.Right()); + } + else + rVal.nWidth = aBoundRect.Right() - rVal.nHPos; + } + + // OD 29.09.2003 #i17567#, #i18732# - consider following the text flow + // and alignment at page areas. + const bool bMaxVPosAtBottom = !rVal.bFollowTextFlow || + rVal.nVRelOrient == text::RelOrientation::PAGE_FRAME || + rVal.nVRelOrient == text::RelOrientation::PAGE_PRINT_AREA; + { + SwTwips nTmpMaxVPos = ( bMaxVPosAtBottom + ? aBoundRect.Bottom() + : aBoundRect.Height() ) - + rVal.nHeight; + if ( rVal.nVPos > nTmpMaxVPos ) + { + if (rVal.nVertOrient == text::VertOrientation::NONE) + { + rVal.nVPos = nTmpMaxVPos; + } + else + { + rVal.nHeight = ( bMaxVPosAtBottom + ? aBoundRect.Bottom() + : aBoundRect.Height() ) - rVal.nVPos; + } + } + } + + rVal.nMinHPos = aBoundRect.Left(); + rVal.nMaxHPos = aBoundRect.Right() - rVal.nWidth; + + rVal.nMinVPos = aBoundRect.Top(); + // OD 26.09.2003 #i17567#, #i18732# - determine maximum vertical position + if ( bMaxVPosAtBottom ) + { + rVal.nMaxVPos = aBoundRect.Bottom() - rVal.nHeight; + } + else + { + rVal.nMaxVPos = aBoundRect.Height() - rVal.nHeight; + } + + // Maximale Breite Hoehe + const SwTwips nH = ( rVal.nHoriOrient != text::HoriOrientation::NONE ) + ? aBoundRect.Left() + : rVal.nHPos; + const SwTwips nV = ( rVal.nVertOrient != text::VertOrientation::NONE ) + ? aBoundRect.Top() + : rVal.nVPos; + rVal.nMaxHeight = rVal.nMaxVPos + rVal.nHeight - nV; + rVal.nMaxWidth = rVal.nMaxHPos + rVal.nWidth - nH; + } + // OD 12.11.2003 #i22341# - special case for to character anchored objects + // vertical aligned at character or top of line. + // Note: (1) positive vertical values are positions above the top of line + // (2) negative vertical values are positions below the top of line + else if ( (eAnchorType == FLY_AT_CHAR) && + ( rVal.nVRelOrient == text::RelOrientation::CHAR || + rVal.nVRelOrient == text::RelOrientation::TEXT_LINE ) ) + { + // determine horizontal values + rVal.nMinHPos = aBoundRect.Left(); + + rVal.nMaxHPos = aBoundRect.Right() - rVal.nWidth; + if (rVal.nHPos + rVal.nWidth > aBoundRect.Right()) + { + if (rVal.nHoriOrient == text::HoriOrientation::NONE) + { + rVal.nHPos -= ((rVal.nHPos + rVal.nWidth) - aBoundRect.Right()); + } + else + rVal.nWidth = aBoundRect.Right() - rVal.nHPos; + } + + const SwTwips nH = ( rVal.nHoriOrient != text::HoriOrientation::NONE ) + ? aBoundRect.Left() + : rVal.nHPos; + rVal.nMaxWidth = rVal.nMaxHPos + rVal.nWidth - nH; + + // determine vertical values + rVal.nMinVPos = -( aBoundRect.Bottom() - rVal.nHeight ); + if ( rVal.nVPos < rVal.nMinVPos && + rVal.nVertOrient == text::VertOrientation::NONE ) + { + rVal.nVPos = rVal.nMinVPos; + } + + rVal.nMaxVPos = -aBoundRect.Top(); + if ( rVal.nVPos > rVal.nMaxVPos && + rVal.nVertOrient == text::VertOrientation::NONE ) + { + rVal.nVPos = rVal.nMaxVPos; + } + + if ( rVal.nVertOrient == text::VertOrientation::NONE ) + { + rVal.nMaxHeight = aBoundRect.Bottom() + rVal.nVPos; + } + else + { + rVal.nMaxHeight = aBoundRect.Height(); + } + } + else if ( eAnchorType == FLY_AS_CHAR ) + { + rVal.nMinHPos = 0; + rVal.nMaxHPos = 0; + + rVal.nMaxHeight = aBoundRect.Height(); + rVal.nMaxWidth = aBoundRect.Width(); + + rVal.nMaxVPos = aBoundRect.Height(); + rVal.nMinVPos = -aBoundRect.Height() + rVal.nHeight; + if (rVal.nMaxVPos < rVal.nMinVPos) + { + rVal.nMinVPos = rVal.nMaxVPos; + rVal.nMaxVPos = -aBoundRect.Height(); + } + } + // --> OD 2009-09-01 #mongolianlayout# + if ( bIsInVertical || bIsInVerticalL2R ) + // <-- + { + //restore width/height exchange + long nTmp = rVal.nWidth; + rVal.nWidth = rVal.nHeight; + rVal.nHeight = nTmp; + } + + if (rVal.nMaxWidth < rVal.nWidth) + rVal.nWidth = rVal.nMaxWidth; + if (rVal.nMaxHeight < rVal.nHeight) + rVal.nHeight = rVal.nMaxHeight; +} + +/*-------------------------------------------------------------------- + Beschreibung: Korrektur fuer Umrandung + --------------------------------------------------------------------*/ + +SwTwips SwFlyFrmAttrMgr::CalcTopSpace() +{ + const SvxShadowItem& rShadow = GetShadow(); + const SvxBoxItem& rBox = GetBox(); + return rShadow.CalcShadowSpace(SHADOW_TOP ) + rBox.CalcLineSpace(BOX_LINE_TOP); +} + +SwTwips SwFlyFrmAttrMgr::CalcBottomSpace() +{ + const SvxShadowItem& rShadow = GetShadow(); + const SvxBoxItem& rBox = GetBox(); + return rShadow.CalcShadowSpace(SHADOW_BOTTOM) + rBox.CalcLineSpace(BOX_LINE_BOTTOM); +} + +SwTwips SwFlyFrmAttrMgr::CalcLeftSpace() +{ + const SvxShadowItem& rShadow = GetShadow(); + const SvxBoxItem& rBox = GetBox(); + return rShadow.CalcShadowSpace(SHADOW_LEFT) + rBox.CalcLineSpace(BOX_LINE_LEFT); +} + +SwTwips SwFlyFrmAttrMgr::CalcRightSpace() +{ + const SvxShadowItem& rShadow = GetShadow(); + const SvxBoxItem& rBox = GetBox(); + return rShadow.CalcShadowSpace(SHADOW_RIGHT) + rBox.CalcLineSpace(BOX_LINE_RIGHT); +} + + +/*-------------------------------------------------------------------- + Beschreibung: Attribut aus dem Set loeschen + --------------------------------------------------------------------*/ +void SwFlyFrmAttrMgr::DelAttr( sal_uInt16 nId ) +{ + aSet.ClearItem( nId ); +} + +void SwFlyFrmAttrMgr::SetLRSpace( long nLeft, long nRight ) +{ + ASSERT( LONG_MAX != nLeft && LONG_MAX != nRight, "Welchen Raend setzen?" ); + + SvxLRSpaceItem aTmp( (SvxLRSpaceItem&)aSet.Get( RES_LR_SPACE ) ); + if( LONG_MAX != nLeft ) + aTmp.SetLeft( sal_uInt16(nLeft) ); + if( LONG_MAX != nRight ) + aTmp.SetRight( sal_uInt16(nRight) ); + aSet.Put( aTmp ); +} + +void SwFlyFrmAttrMgr::SetULSpace( long nTop, long nBottom ) +{ + ASSERT(LONG_MAX != nTop && LONG_MAX != nBottom, "Welchen Raend setzen?" ); + + SvxULSpaceItem aTmp( (SvxULSpaceItem&)aSet.Get( RES_UL_SPACE ) ); + if( LONG_MAX != nTop ) + aTmp.SetUpper( sal_uInt16(nTop) ); + if( LONG_MAX != nBottom ) + aTmp.SetLower( sal_uInt16(nBottom) ); + aSet.Put( aTmp ); +} + +void SwFlyFrmAttrMgr::SetPos( const Point& rPoint ) +{ + SwFmtVertOrient aVertOrient( GetVertOrient() ); + SwFmtHoriOrient aHoriOrient( GetHoriOrient() ); + + aHoriOrient.SetPos ( rPoint.X() ); + aHoriOrient.SetHoriOrient( text::HoriOrientation::NONE ); + + aVertOrient.SetPos ( rPoint.Y() ); + aVertOrient.SetVertOrient( text::VertOrientation::NONE ); + + aSet.Put( aVertOrient ); + aSet.Put( aHoriOrient ); +} + +void SwFlyFrmAttrMgr::SetHorzOrientation( sal_Int16 eOrient ) +{ + SwFmtHoriOrient aHoriOrient( GetHoriOrient() ); + aHoriOrient.SetHoriOrient( eOrient ); + aSet.Put( aHoriOrient ); +} + +void SwFlyFrmAttrMgr::SetVertOrientation( sal_Int16 eOrient ) +{ + SwFmtVertOrient aVertOrient( GetVertOrient() ); + aVertOrient.SetVertOrient( eOrient ); + aSet.Put( aVertOrient ); +} + +void SwFlyFrmAttrMgr::SetHeightSizeType( SwFrmSize eType ) +{ + SwFmtFrmSize aSize( GetFrmSize() ); + aSize.SetHeightSizeType( eType ); + aSet.Put( aSize ); +} + +void SwFlyFrmAttrMgr::SetSize( const Size& rSize ) +{ + SwFmtFrmSize aSize( GetFrmSize() ); + aSize.SetSize(Size(Max(rSize.Width(), long(MINFLY)), Max(rSize.Height(), long(MINFLY)))); + aSet.Put( aSize ); +} + +void SwFlyFrmAttrMgr::SetAttrSet(const SfxItemSet& rSet) +{ + aSet.ClearItem(); + aSet.Put( rSet ); +} diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx new file mode 100644 index 000000000000..99ba59d9d852 --- /dev/null +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -0,0 +1,3345 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + +#include <com/sun/star/embed/Aspects.hpp> +#include <com/sun/star/embed/EmbedMisc.hpp> + +#include <cmdid.h> +#include <helpid.h> +#include <hintids.hxx> +#include <vcl/msgbox.hxx> +#include <vcl/mnemonic.hxx> +#include <svl/urihelper.hxx> +#include <svl/stritem.hxx> +#include <svx/htmlmode.hxx> +#include <editeng/sizeitem.hxx> +#include <editeng/opaqitem.hxx> +#include <editeng/protitem.hxx> +#include <editeng/prntitem.hxx> +#include <editeng/brshitem.hxx> +#include <editeng/ulspitem.hxx> +#include <editeng/frmdiritem.hxx> +#include <svx/swframevalidation.hxx> +#include <sot/clsids.hxx> + +#include <sfx2/viewfrm.hxx> +#include <fmturl.hxx> +#include <fmteiro.hxx> +#include <fmtcnct.hxx> +#include <view.hxx> +#include <wrtsh.hxx> +#include <swmodule.hxx> +#include <uitool.hxx> +#include <docsh.hxx> +#include <viewopt.hxx> +#include <frmatr.hxx> +#include <frmdlg.hxx> +#include <frmmgr.hxx> +#include <frmpage.hxx> +#include <wrap.hxx> +#include <colmgr.hxx> +#include <grfatr.hxx> +#include <uiitems.hxx> +// OD 19.09.2003 #i18732# +#include <fmtfollowtextflow.hxx> + +#include <frmui.hrc> +#include <frmpage.hrc> +#include <sfx2/filedlghelper.hxx> +#include "com/sun/star/ui/dialogs/TemplateDescription.hpp" +#include <com/sun/star/ui/dialogs/XFilePicker.hpp> +#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp> +#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp> +#include <svtools/filter.hxx> + +using namespace ::com::sun::star; +using ::rtl::OUString; +using namespace ::sfx2; + +#define SwFPos SvxSwFramePosString + +struct FrmMap +{ + SvxSwFramePosString::StringId eStrId; + SvxSwFramePosString::StringId eMirrorStrId; + sal_uInt16 nAlign; + sal_uLong nLBRelations; +}; + +struct RelationMap +{ + SvxSwFramePosString::StringId eStrId; + SvxSwFramePosString::StringId eMirrorStrId; + sal_uLong nLBRelation; + sal_uInt16 nRelation; +}; + +struct StringIdPair_Impl +{ + SvxSwFramePosString::StringId eHori; + SvxSwFramePosString::StringId eVert; +}; + +#define MAX_PERCENT_WIDTH 254L +#define MAX_PERCENT_HEIGHT 254L + +// OD 19.09.2003 #i18732# - change order of alignments +#define LB_FRAME 0x00000001L // Textbereich des Absatzes +#define LB_PRTAREA 0x00000002L // Textbereich des Absatzes + Einzuege +#define LB_VERT_FRAME 0x00000004L // Vertikaler Textbereich des Absatzes +#define LB_VERT_PRTAREA 0x00000008L // Vertikaler Textbereich des Absatzes + Einzuege +#define LB_REL_FRM_LEFT 0x00000010L // Linker Absatzrand +#define LB_REL_FRM_RIGHT 0x00000020L // Rechter Absatzrand + +#define LB_REL_PG_LEFT 0x00000040L // Linker Seitenrand +#define LB_REL_PG_RIGHT 0x00000080L // Rechter Seitenrand +#define LB_REL_PG_FRAME 0x00000100L // Gesamte Seite +#define LB_REL_PG_PRTAREA 0x00000200L // Textbereich der Seite + +#define LB_FLY_REL_PG_LEFT 0x00000400L // Linker Rahmenrand +#define LB_FLY_REL_PG_RIGHT 0x00000800L // Rechter Rahmenrand +#define LB_FLY_REL_PG_FRAME 0x00001000L // Gesamte Rahmen +#define LB_FLY_REL_PG_PRTAREA 0x00002000L // Rahmeninneres + +#define LB_REL_BASE 0x00010000L // Zeichenausrichtung Basis +#define LB_REL_CHAR 0x00020000L // Zeichenausrichtung Zeichen +#define LB_REL_ROW 0x00040000L // Zeichenausrichtung Zeile + +// OD 10.11.2003 #i22305# +#define LB_FLY_VERT_FRAME 0x00100000L // vertical entire frame +#define LB_FLY_VERT_PRTAREA 0x00200000L // vertical frame text area + +// OD 11.11.2003 #i22341# +#define LB_VERT_LINE 0x00400000L // vertical text line + +static RelationMap __FAR_DATA aRelationMap[] = +{ + {SwFPos::FRAME, SwFPos::FRAME, LB_FRAME, text::RelOrientation::FRAME}, + {SwFPos::PRTAREA, SwFPos::PRTAREA, LB_PRTAREA, text::RelOrientation::PRINT_AREA}, + {SwFPos::REL_PG_LEFT, SwFPos::MIR_REL_PG_LEFT, LB_REL_PG_LEFT, text::RelOrientation::PAGE_LEFT}, + {SwFPos::REL_PG_RIGHT, SwFPos::MIR_REL_PG_RIGHT, LB_REL_PG_RIGHT, text::RelOrientation::PAGE_RIGHT}, + {SwFPos::REL_FRM_LEFT, SwFPos::MIR_REL_FRM_LEFT, LB_REL_FRM_LEFT, text::RelOrientation::FRAME_LEFT}, + {SwFPos::REL_FRM_RIGHT, SwFPos::MIR_REL_FRM_RIGHT, LB_REL_FRM_RIGHT, text::RelOrientation::FRAME_RIGHT}, + {SwFPos::REL_PG_FRAME, SwFPos::REL_PG_FRAME, LB_REL_PG_FRAME, text::RelOrientation::PAGE_FRAME}, + {SwFPos::REL_PG_PRTAREA, SwFPos::REL_PG_PRTAREA, LB_REL_PG_PRTAREA, text::RelOrientation::PAGE_PRINT_AREA}, + {SwFPos::REL_CHAR, SwFPos::REL_CHAR, LB_REL_CHAR, text::RelOrientation::CHAR}, + + {SwFPos::FLY_REL_PG_LEFT, SwFPos::FLY_MIR_REL_PG_LEFT, LB_FLY_REL_PG_LEFT, text::RelOrientation::PAGE_LEFT}, + {SwFPos::FLY_REL_PG_RIGHT, SwFPos::FLY_MIR_REL_PG_RIGHT, LB_FLY_REL_PG_RIGHT, text::RelOrientation::PAGE_RIGHT}, + {SwFPos::FLY_REL_PG_FRAME, SwFPos::FLY_REL_PG_FRAME, LB_FLY_REL_PG_FRAME, text::RelOrientation::PAGE_FRAME}, + {SwFPos::FLY_REL_PG_PRTAREA, SwFPos::FLY_REL_PG_PRTAREA, LB_FLY_REL_PG_PRTAREA, text::RelOrientation::PAGE_PRINT_AREA}, + + {SwFPos::REL_BORDER, SwFPos::REL_BORDER, LB_VERT_FRAME, text::RelOrientation::FRAME}, + {SwFPos::REL_PRTAREA, SwFPos::REL_PRTAREA, LB_VERT_PRTAREA, text::RelOrientation::PRINT_AREA}, + + // OD 10.11.2003 #i22305# + {SwFPos::FLY_REL_PG_FRAME, SwFPos::FLY_REL_PG_FRAME, LB_FLY_VERT_FRAME, text::RelOrientation::FRAME}, + {SwFPos::FLY_REL_PG_PRTAREA, SwFPos::FLY_REL_PG_PRTAREA, LB_FLY_VERT_PRTAREA, text::RelOrientation::PRINT_AREA}, + + // OD 11.11.2003 #i22341# + {SwFPos::REL_LINE, SwFPos::REL_LINE, LB_VERT_LINE, text::RelOrientation::TEXT_LINE} +}; + +static RelationMap __FAR_DATA aAsCharRelationMap[] = +{ + {SwFPos::REL_BASE, SwFPos::REL_BASE, LB_REL_BASE, text::RelOrientation::FRAME}, + {SwFPos::REL_CHAR, SwFPos::REL_CHAR, LB_REL_CHAR, text::RelOrientation::FRAME}, + {SwFPos::REL_ROW, SwFPos::REL_ROW, LB_REL_ROW, text::RelOrientation::FRAME} +}; + +/*-------------------------------------------------------------------- + Beschreibung: Seite verankert + --------------------------------------------------------------------*/ + +#define HORI_PAGE_REL (LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_PG_LEFT| \ + LB_REL_PG_RIGHT) + +static FrmMap __FAR_DATA aHPageMap[] = +{ + {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HORI_PAGE_REL}, + {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HORI_PAGE_REL}, + {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, text::HoriOrientation::CENTER, HORI_PAGE_REL}, + {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, HORI_PAGE_REL} +}; + +static FrmMap __FAR_DATA aHPageHtmlMap[] = +{ + {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, LB_REL_PG_FRAME} +}; + +#define VERT_PAGE_REL (LB_REL_PG_FRAME|LB_REL_PG_PRTAREA) + +static FrmMap __FAR_DATA aVPageMap[] = +{ + {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, VERT_PAGE_REL}, + {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, VERT_PAGE_REL}, + {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, VERT_PAGE_REL}, + {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, VERT_PAGE_REL} +}; + +static FrmMap __FAR_DATA aVPageHtmlMap[] = +{ + {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, LB_REL_PG_FRAME} +}; + +/*-------------------------------------------------------------------- + Beschreibung: Rahmen verankert + --------------------------------------------------------------------*/ + +#define HORI_FRAME_REL (LB_FLY_REL_PG_FRAME|LB_FLY_REL_PG_PRTAREA| \ + LB_FLY_REL_PG_LEFT|LB_FLY_REL_PG_RIGHT) + +static FrmMap __FAR_DATA aHFrameMap[] = +{ + {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HORI_FRAME_REL}, + {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HORI_FRAME_REL}, + {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, text::HoriOrientation::CENTER, HORI_FRAME_REL}, + {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, HORI_FRAME_REL} +}; + +static FrmMap __FAR_DATA aHFlyHtmlMap[] = +{ + {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, LB_FLY_REL_PG_FRAME}, + {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, LB_FLY_REL_PG_FRAME} +}; + +// OD 19.09.2003 #i18732# - own vertical alignment map for to frame anchored objects +// OD 10.11.2003 #i22305# +#define VERT_FRAME_REL (LB_FLY_VERT_FRAME|LB_FLY_VERT_PRTAREA) + +static FrmMap __FAR_DATA aVFrameMap[] = +{ + {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, VERT_FRAME_REL}, + {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, VERT_FRAME_REL}, + {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, VERT_FRAME_REL}, + {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, VERT_FRAME_REL} +}; + +static FrmMap __FAR_DATA aVFlyHtmlMap[] = +{ + // OD 10.11.2003 #i22305# + {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB_FLY_VERT_FRAME}, + {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, LB_FLY_VERT_FRAME} +}; + +/*-------------------------------------------------------------------- + Beschreibung: Absatz verankert + --------------------------------------------------------------------*/ + +#define HORI_PARA_REL (LB_FRAME|LB_PRTAREA|LB_REL_PG_LEFT|LB_REL_PG_RIGHT| \ + LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_FRM_LEFT| \ + LB_REL_FRM_RIGHT) + +static FrmMap __FAR_DATA aHParaMap[] = +{ + {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HORI_PARA_REL}, + {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HORI_PARA_REL}, + {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, text::HoriOrientation::CENTER, HORI_PARA_REL}, + {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, HORI_PARA_REL} +}; + +#define HTML_HORI_PARA_REL (LB_FRAME|LB_PRTAREA) + +static FrmMap __FAR_DATA aHParaHtmlMap[] = +{ + {SwFPos::LEFT, SwFPos::LEFT, text::HoriOrientation::LEFT, HTML_HORI_PARA_REL}, + {SwFPos::RIGHT, SwFPos::RIGHT, text::HoriOrientation::RIGHT, HTML_HORI_PARA_REL} +}; + +static FrmMap __FAR_DATA aHParaHtmlAbsMap[] = +{ + {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HTML_HORI_PARA_REL}, + {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HTML_HORI_PARA_REL} +}; + +// OD 19.09.2003 #i18732# - allow vertical alignment at page areas +#define VERT_PARA_REL (LB_VERT_FRAME|LB_VERT_PRTAREA| \ + LB_REL_PG_FRAME|LB_REL_PG_PRTAREA) + +static FrmMap __FAR_DATA aVParaMap[] = +{ + {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, VERT_PARA_REL}, + {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, VERT_PARA_REL}, + {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, VERT_PARA_REL}, + {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, VERT_PARA_REL} +}; + +static FrmMap __FAR_DATA aVParaHtmlMap[] = +{ + {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB_VERT_PRTAREA} +}; + +/*-------------------------------------------------------------------- + Beschreibung: Relativ zum Zeichen verankert + --------------------------------------------------------------------*/ + +#define HORI_CHAR_REL (LB_FRAME|LB_PRTAREA|LB_REL_PG_LEFT|LB_REL_PG_RIGHT| \ + LB_REL_PG_FRAME|LB_REL_PG_PRTAREA|LB_REL_FRM_LEFT| \ + LB_REL_FRM_RIGHT|LB_REL_CHAR) + +static FrmMap __FAR_DATA aHCharMap[] = +{ + {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, HORI_CHAR_REL}, + {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, HORI_CHAR_REL}, + {SwFPos::CENTER_HORI, SwFPos::CENTER_HORI, text::HoriOrientation::CENTER, HORI_CHAR_REL}, + {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, HORI_CHAR_REL} +}; + +#define HTML_HORI_CHAR_REL (LB_FRAME|LB_PRTAREA|LB_REL_CHAR) + +static FrmMap __FAR_DATA aHCharHtmlMap[] = +{ + {SwFPos::LEFT, SwFPos::LEFT, text::HoriOrientation::LEFT, HTML_HORI_CHAR_REL}, + {SwFPos::RIGHT, SwFPos::RIGHT, text::HoriOrientation::RIGHT, HTML_HORI_CHAR_REL} +}; + +static FrmMap __FAR_DATA aHCharHtmlAbsMap[] = +{ + {SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, LB_PRTAREA|LB_REL_CHAR}, + {SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, LB_PRTAREA}, + {SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, LB_REL_PG_FRAME} +}; + +// OD 19.09.2003 #i18732# - allow vertical alignment at page areas +// OD 12.11.2003 #i22341# - handle <LB_REL_CHAR> on its own +#define VERT_CHAR_REL (LB_VERT_FRAME|LB_VERT_PRTAREA| \ + LB_REL_PG_FRAME|LB_REL_PG_PRTAREA) + +static FrmMap __FAR_DATA aVCharMap[] = +{ + // OD 11.11.2003 #i22341# + // introduce mappings for new vertical alignment at top of line <LB_VERT_LINE> + // and correct mapping for vertical alignment at character for position <FROM_BOTTOM> + // Note: Because of these adjustments the map becomes ambigous in its values + // <eStrId>/<eMirrorStrId> and <nAlign>. These ambiguities are considered + // in the methods <SwFrmPage::FillRelLB(..)>, <SwFrmPage::GetAlignment(..)> + // and <SwFrmPage::FillPosLB(..)> + {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, VERT_CHAR_REL|LB_REL_CHAR}, + {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, VERT_CHAR_REL|LB_REL_CHAR}, + {SwFPos::BELOW, SwFPos::BELOW, text::VertOrientation::CHAR_BOTTOM, LB_REL_CHAR}, + {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, VERT_CHAR_REL|LB_REL_CHAR}, + {SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, VERT_CHAR_REL}, + {SwFPos::FROMBOTTOM, SwFPos::FROMBOTTOM, text::VertOrientation::NONE, LB_REL_CHAR|LB_VERT_LINE}, + {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::LINE_TOP, LB_VERT_LINE}, + {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::LINE_BOTTOM, LB_VERT_LINE}, + {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::LINE_CENTER, LB_VERT_LINE} +}; + + +static FrmMap __FAR_DATA aVCharHtmlMap[] = +{ + {SwFPos::BELOW, SwFPos::BELOW, text::VertOrientation::CHAR_BOTTOM, LB_REL_CHAR} +}; + +static FrmMap __FAR_DATA aVCharHtmlAbsMap[] = +{ + {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB_REL_CHAR}, + {SwFPos::BELOW, SwFPos::BELOW, text::VertOrientation::CHAR_BOTTOM, LB_REL_CHAR} +}; +/*-------------------------------------------------------------------- + Beschreibung: Als Zeichen verankert + --------------------------------------------------------------------*/ + +static FrmMap __FAR_DATA aVAsCharMap[] = +{ + {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB_REL_BASE}, + {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, LB_REL_BASE}, + {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, LB_REL_BASE}, + + {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::CHAR_TOP, LB_REL_CHAR}, + {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::CHAR_BOTTOM, LB_REL_CHAR}, + {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CHAR_CENTER, LB_REL_CHAR}, + + {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::LINE_TOP, LB_REL_ROW}, + {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::LINE_BOTTOM, LB_REL_ROW}, + {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::LINE_CENTER, LB_REL_ROW}, + + {SwFPos::FROMBOTTOM, SwFPos::FROMBOTTOM, text::VertOrientation::NONE, LB_REL_BASE} +}; + +static FrmMap __FAR_DATA aVAsCharHtmlMap[] = +{ + {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB_REL_BASE}, + {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, LB_REL_BASE}, + + {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::CHAR_TOP, LB_REL_CHAR}, + + {SwFPos::TOP, SwFPos::TOP, text::VertOrientation::LINE_TOP, LB_REL_ROW}, + {SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::LINE_BOTTOM, LB_REL_ROW}, + {SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::LINE_CENTER, LB_REL_ROW} +}; + +static sal_uInt16 __FAR_DATA aPageRg[] = { + RES_FRM_SIZE, RES_FRM_SIZE, + RES_VERT_ORIENT, RES_ANCHOR, + RES_COL, RES_COL, + RES_FOLLOW_TEXT_FLOW, RES_FOLLOW_TEXT_FLOW, + 0 +}; +static sal_uInt16 __FAR_DATA aAddPgRg[] = { + RES_PROTECT, RES_PROTECT, + RES_PRINT, RES_PRINT, + FN_SET_FRM_NAME, FN_SET_FRM_NAME, + FN_SET_FRM_ALT_NAME, FN_SET_FRM_ALT_NAME, + 0 +}; + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +size_t lcl_GetFrmMapCount( const FrmMap* pMap) +{ + if ( pMap ) + { + int aSizeOf = sizeof(FrmMap); + if( pMap == aVParaHtmlMap) + return sizeof(aVParaHtmlMap) / aSizeOf; + if( pMap == aVAsCharHtmlMap) + return sizeof(aVAsCharHtmlMap) / aSizeOf; + if( pMap == aHParaHtmlMap) + return sizeof(aHParaHtmlMap) / aSizeOf; + if( pMap == aHParaHtmlAbsMap) + return sizeof(aHParaHtmlAbsMap) / aSizeOf; + if ( pMap == aVPageMap ) + return sizeof(aVPageMap) / aSizeOf; + if ( pMap == aVPageHtmlMap ) + return sizeof(aVPageHtmlMap) / aSizeOf; + if ( pMap == aVAsCharMap ) + return sizeof(aVAsCharMap) / aSizeOf; + if ( pMap == aVParaMap ) + return sizeof(aVParaMap) / aSizeOf; + if ( pMap == aHParaMap ) + return sizeof(aHParaMap) / aSizeOf; + if ( pMap == aHFrameMap ) + return sizeof(aHFrameMap) / aSizeOf; + // OD 19.09.2003 #i18732# - own vertical alignment map for to frame anchored objects + if ( pMap == aVFrameMap ) + return sizeof(aVFrameMap) / aSizeOf; + if ( pMap == aHCharMap ) + return sizeof(aHCharMap) / aSizeOf; + if ( pMap == aHCharHtmlMap ) + return sizeof(aHCharHtmlMap) / aSizeOf; + if ( pMap == aHCharHtmlAbsMap ) + return sizeof(aHCharHtmlAbsMap) / aSizeOf; + if ( pMap == aVCharMap ) + return sizeof(aVCharMap) / aSizeOf; + if ( pMap == aVCharHtmlMap ) + return sizeof(aVCharHtmlMap) / aSizeOf; + if ( pMap == aVCharHtmlAbsMap ) + return sizeof(aVCharHtmlAbsMap) / aSizeOf; + if ( pMap == aHPageHtmlMap ) + return sizeof(aHPageHtmlMap) / aSizeOf; + if ( pMap == aHFlyHtmlMap ) + return sizeof(aHFlyHtmlMap) / aSizeOf; + if ( pMap == aVFlyHtmlMap ) + return sizeof(aVFlyHtmlMap) / aSizeOf; + return sizeof(aHPageMap) / aSizeOf; + } + return 0; +} +/* -----------------------------08.08.2002 14:45------------------------------ + + ---------------------------------------------------------------------------*/ +void lcl_InsertVectors(ListBox& rBox, + const ::std::vector< String >& rPrev, const ::std::vector< String >& rThis, + const ::std::vector< String >& rNext, const ::std::vector< String >& rRemain) +{ + ::std::vector< String >::const_iterator aIt; + sal_uInt16 nEntry = 0; + for(aIt = rPrev.begin(); aIt != rPrev.end(); aIt++) + nEntry = rBox.InsertEntry(*aIt); + for(aIt = rThis.begin(); aIt != rThis.end(); aIt++) + nEntry = rBox.InsertEntry(*aIt); + for(aIt = rNext.begin(); aIt != rNext.end(); aIt++) + nEntry = rBox.InsertEntry(*aIt); + rBox.SetSeparatorPos(nEntry); + //now insert all strings sorted + sal_uInt16 nStartPos = rBox.GetEntryCount(); + + for(aIt = rPrev.begin(); aIt != rPrev.end(); aIt++) + ::InsertStringSorted(*aIt, rBox, nStartPos ); + for(aIt = rThis.begin(); aIt != rThis.end(); aIt++) + ::InsertStringSorted(*aIt, rBox, nStartPos ); + for(aIt = rNext.begin(); aIt != rNext.end(); aIt++) + ::InsertStringSorted(*aIt, rBox, nStartPos ); + for(aIt = rRemain.begin(); aIt != rRemain.end(); aIt++) + ::InsertStringSorted(*aIt, rBox, nStartPos ); +} + +/* -----------------------------20.08.2002 16:12------------------------------ + + ---------------------------------------------------------------------------*/ +// --> OD 2009-08-31 #mongolianlayout# +// add input parameter +SvxSwFramePosString::StringId lcl_ChangeResIdToVerticalOrRTL(SvxSwFramePosString::StringId eStringId, sal_Bool bVertical, sal_Bool bVerticalL2R, sal_Bool bRTL) +{ + //special handling of STR_FROMLEFT + if ( SwFPos::FROMLEFT == eStringId ) + { + eStringId = bVertical + ? ( bRTL + ? SwFPos::FROMBOTTOM + : SwFPos::FROMTOP ) + : ( bRTL + ? SwFPos::FROMRIGHT + : SwFPos::FROMLEFT ); + return eStringId; + } + // --> OD 2009-08-31 #mongolianlayout# + // special handling of STR_FROMTOP in case of mongolianlayout (vertical left-to-right) + if ( SwFPos::FROMTOP == eStringId && + bVertical && bVerticalL2R ) + { + eStringId = SwFPos::FROMLEFT; + return eStringId; + } + // <-- + if ( bVertical ) + { + //exchange horizontal strings with vertical strings and vice versa + static const StringIdPair_Impl aHoriIds[] = + { + {SwFPos::LEFT, SwFPos::TOP}, + {SwFPos::RIGHT, SwFPos::BOTTOM}, + {SwFPos::CENTER_HORI, SwFPos::CENTER_VERT}, + {SwFPos::FROMTOP, SwFPos::FROMRIGHT}, + {SwFPos::REL_PG_LEFT, SwFPos::REL_PG_TOP}, + {SwFPos::REL_PG_RIGHT, SwFPos::REL_PG_BOTTOM} , + {SwFPos::REL_FRM_LEFT, SwFPos::REL_FRM_TOP}, + {SwFPos::REL_FRM_RIGHT, SwFPos::REL_FRM_BOTTOM} + }; + static const StringIdPair_Impl aVertIds[] = + { + {SwFPos::TOP, SwFPos::RIGHT}, + {SwFPos::BOTTOM, SwFPos::LEFT }, + {SwFPos::CENTER_VERT, SwFPos::CENTER_HORI}, + {SwFPos::FROMTOP, SwFPos::FROMRIGHT }, + {SwFPos::REL_PG_TOP, SwFPos::REL_PG_LEFT }, + {SwFPos::REL_PG_BOTTOM, SwFPos::REL_PG_RIGHT } , + {SwFPos::REL_FRM_TOP, SwFPos::REL_FRM_LEFT }, + {SwFPos::REL_FRM_BOTTOM, SwFPos::REL_FRM_RIGHT } + }; + // --> OD 2009-08-31 #monglianlayout# + static const StringIdPair_Impl aVertL2RIds[] = + { + {SwFPos::TOP, SwFPos::LEFT }, + {SwFPos::BOTTOM, SwFPos::RIGHT }, + {SwFPos::CENTER_VERT, SwFPos::CENTER_HORI }, + {SwFPos::FROMTOP, SwFPos::FROMLEFT }, + {SwFPos::REL_PG_TOP, SwFPos::REL_PG_LEFT }, + {SwFPos::REL_PG_BOTTOM, SwFPos::REL_PG_RIGHT } , + {SwFPos::REL_FRM_TOP, SwFPos::REL_FRM_LEFT }, + {SwFPos::REL_FRM_BOTTOM, SwFPos::REL_FRM_RIGHT } + }; + // <-- + sal_uInt16 nIndex; + for(nIndex = 0; nIndex < sizeof(aHoriIds) / sizeof(StringIdPair_Impl); ++nIndex) + { + if(aHoriIds[nIndex].eHori == eStringId) + { + eStringId = aHoriIds[nIndex].eVert; + return eStringId; + } + } + nIndex = 0; + for(nIndex = 0; nIndex < sizeof(aVertIds) / sizeof(StringIdPair_Impl); ++nIndex) + { + // --> OD 2009-08-31 #mongolianlayout# + if ( !bVerticalL2R ) + { + if(aVertIds[nIndex].eHori == eStringId) + { + eStringId = aVertIds[nIndex].eVert; + break; + } + } + else + { + if(aVertL2RIds[nIndex].eHori == eStringId) + { + eStringId = aVertL2RIds[nIndex].eVert; + break; + } + } + // <-- + } + } + return eStringId; +} + +// OD 12.11.2003 #i22341# - helper method in order to determine all possible +// listbox relations in a relation map for a given relation +sal_uLong lcl_GetLBRelationsForRelations( const sal_uInt16 _nRel ) +{ + sal_uLong nLBRelations = 0L; + + sal_uInt16 nRelMapSize = sizeof(aRelationMap) / sizeof(RelationMap); + for ( sal_uInt16 nRelMapPos = 0; nRelMapPos < nRelMapSize; ++nRelMapPos ) + { + if ( aRelationMap[nRelMapPos].nRelation == _nRel ) + { + nLBRelations |= aRelationMap[nRelMapPos].nLBRelation; + } + } + + return nLBRelations; +} + +// OD 14.11.2003 #i22341# - helper method on order to determine all possible +// listbox relations in a relation map for a given string ID +sal_uLong lcl_GetLBRelationsForStrID( const FrmMap* _pMap, + const SvxSwFramePosString::StringId _eStrId, + const bool _bUseMirrorStr ) +{ + sal_uLong nLBRelations = 0L; + + size_t nRelMapSize = lcl_GetFrmMapCount( _pMap ); + for ( size_t nRelMapPos = 0; nRelMapPos < nRelMapSize; ++nRelMapPos ) + { + if ( ( !_bUseMirrorStr && _pMap[nRelMapPos].eStrId == _eStrId ) || + ( _bUseMirrorStr && _pMap[nRelMapPos].eMirrorStrId == _eStrId ) ) + { + nLBRelations |= _pMap[nRelMapPos].nLBRelations; + } + } + + return nLBRelations; +} + +/*-------------------------------------------------------------------- + Beschreibung: StandardRahmenTabPage + --------------------------------------------------------------------*/ + +namespace +{ + void HandleAutoCB( sal_Bool _bChecked, FixedText& _rFT_man, FixedText& _rFT_auto ) + { + _rFT_man.Show( !_bChecked ); + _rFT_auto.Show( _bChecked ); + } +} + + +SwFrmPage::SwFrmPage ( Window *pParent, const SfxItemSet &rSet ) : + SfxTabPage (pParent, SW_RES(TP_FRM_STD), rSet), + + aSizeFL (this, SW_RES(FL_SIZE)), + aWidthFT (this, SW_RES(FT_WIDTH)), + aWidthAutoFT (this, SW_RES(FT_WIDTH_AUTO)), + aWidthED (this, SW_RES(ED_WIDTH)), + aRelWidthCB (this, SW_RES(CB_REL_WIDTH)), + aAutoWidthCB (this, SW_RES(CB_AUTOWIDTH)), + aHeightFT (this, SW_RES(FT_HEIGHT)), + aHeightAutoFT (this, SW_RES(FT_HEIGHT_AUTO)), + aHeightED (this, SW_RES(ED_HEIGHT)), + aRelHeightCB (this, SW_RES(CB_REL_HEIGHT)), + aAutoHeightCB (this, SW_RES(CB_AUTOHEIGHT)), + aFixedRatioCB (this, SW_RES(CB_FIXEDRATIO)), + aRealSizeBT (this, SW_RES(BT_REALSIZE)), + + aTypeSepFL (this, SW_RES(FL_TYPE_SEP)), + aTypeFL (this, SW_RES(FL_TYPE)), + aAnchorAtPageRB (this, SW_RES(RB_ANCHOR_PAGE)), + aAnchorAtParaRB (this, SW_RES(RB_ANCHOR_PARA)), + aAnchorAtCharRB (this, SW_RES(RB_ANCHOR_AT_CHAR)), + aAnchorAsCharRB (this, SW_RES(RB_ANCHOR_AS_CHAR)), + aAnchorAtFrameRB(this, SW_RES(RB_ANCHOR_FRAME)), + + aPositionFL (this, SW_RES(FL_POSITION)), + aHorizontalFT (this, SW_RES(FT_HORIZONTAL)), + aHorizontalDLB (this, SW_RES(DLB_HORIZONTAL)), + aAtHorzPosFT (this, SW_RES(FT_AT_HORZ_POS)), + aAtHorzPosED (this, SW_RES(ED_AT_HORZ_POS)), + aHoriRelationFT (this, SW_RES(FT_HORI_RELATION)), + aHoriRelationLB (this, SW_RES(LB_HORI_RELATION)), + aMirrorPagesCB (this, SW_RES(CB_MIRROR)), + aVerticalFT (this, SW_RES(FT_VERTICAL)), + aVerticalDLB (this, SW_RES(DLB_VERTICAL)), + aAtVertPosFT (this, SW_RES(FT_AT_VERT_POS)), + aAtVertPosED (this, SW_RES(ED_AT_VERT_POS)), + aVertRelationFT (this, SW_RES(FT_VERT_RELATION)), + aVertRelationLB (this, SW_RES(LB_VERT_RELATION)), + // OD 19.09.2003 #i18732# - new checkbox + aFollowTextFlowCB(this, SW_RES(CB_FOLLOWTEXTFLOW)), + + aExampleWN (this, SW_RES(WN_BSP)), + + bAtHorzPosModified( sal_False ), + bAtVertPosModified( sal_False ), + bFormat(sal_False), + bNew(sal_True), + bNoModifyHdl(sal_True), + // --> OD 2009-08-31 #mongolianlayout# - no used +// bVerticalChanged(FALSE), + // <-- + bIsVerticalFrame(sal_False), + // --> OD 2009-08-31 #mongolianlayou# + bIsVerticalL2R(sal_False), + // <-- + bIsInRightToLeft(sal_False), + bHtmlMode(sal_False), + nHtmlMode(0), + nDlgType(0), + nUpperBorder(0), + nLowerBorder(0), + fWidthHeightRatio(1.0), + // OD 12.11.2003 #i22341# + mpToCharCntntPos( NULL ), + + nOldH(text::HoriOrientation::CENTER), + nOldHRel(text::RelOrientation::FRAME), + nOldV(text::VertOrientation::TOP), + nOldVRel(text::RelOrientation::PRINT_AREA), + pVMap( 0 ), + pHMap( 0 ), + m_bAllowVertPositioning( true ), + m_bIsMathOLE( false ), + m_bIsMathBaselineAlignment( true ) +{ + FreeResource(); + SetExchangeSupport(); + + aRealSizeBT.SetAccessibleRelationMemberOf(&aSizeFL); + + Link aLk = LINK(this, SwFrmPage, RangeModifyHdl); + aWidthED. SetLoseFocusHdl( aLk ); + aHeightED. SetLoseFocusHdl( aLk ); + aAtHorzPosED.SetLoseFocusHdl( aLk ); + aAtVertPosED.SetLoseFocusHdl( aLk ); + // OD 25.09.2003 #i18732# - click handler for new checkbox + aFollowTextFlowCB.SetClickHdl( aLk ); + + aLk = LINK(this, SwFrmPage, ModifyHdl); + aWidthED. SetModifyHdl( aLk ); + aHeightED. SetModifyHdl( aLk ); + aAtHorzPosED.SetModifyHdl( aLk ); + aAtVertPosED.SetModifyHdl( aLk ); + + aLk = LINK(this, SwFrmPage, AnchorTypeHdl); + aAnchorAtPageRB.SetClickHdl( aLk ); + aAnchorAtParaRB.SetClickHdl( aLk ); + aAnchorAtCharRB.SetClickHdl( aLk ); + aAnchorAsCharRB.SetClickHdl( aLk ); + aAnchorAtFrameRB.SetClickHdl( aLk ); + + aHorizontalDLB.SetSelectHdl(LINK(this, SwFrmPage, PosHdl)); + aVerticalDLB. SetSelectHdl(LINK(this, SwFrmPage, PosHdl)); + + aHoriRelationLB.SetSelectHdl(LINK(this, SwFrmPage, RelHdl)); + aVertRelationLB.SetSelectHdl(LINK(this, SwFrmPage, RelHdl)); + + aMirrorPagesCB.SetClickHdl(LINK(this, SwFrmPage, MirrorHdl)); + + aLk = LINK(this, SwFrmPage, RelSizeClickHdl); + aRelWidthCB.SetClickHdl( aLk ); + aRelHeightCB.SetClickHdl( aLk ); + + aAutoWidthCB.SetClickHdl( LINK( this, SwFrmPage, AutoWidthClickHdl ) ); + aAutoHeightCB.SetClickHdl( LINK( this, SwFrmPage, AutoHeightClickHdl ) ); +} + +/*-------------------------------------------------------------------- + Beschreibung: Dtor + --------------------------------------------------------------------*/ + +SwFrmPage::~SwFrmPage() +{ +} + +SfxTabPage* SwFrmPage::Create(Window *pParent, const SfxItemSet &rSet) +{ + return new SwFrmPage( pParent, rSet ); +} + +namespace +{ + void MoveControl( Control& _rCtrl, long _nOffsetY ) + { + Point aPt( _rCtrl.GetPosPixel() ); + aPt.Move( 0, _nOffsetY ); + _rCtrl.SetPosPixel( aPt ); + } +} + +void SwFrmPage::EnableGraficMode( void ) +{ + // #i39692# mustn't be called more than once + if(!aRealSizeBT.IsVisible()) + { + long nOffset1 = aRelWidthCB.GetPosPixel().Y() - aAutoWidthCB.GetPosPixel().Y(); + long nOffset2 = nOffset1 + aRelHeightCB.GetPosPixel().Y() - aAutoHeightCB.GetPosPixel().Y(); + + MoveControl( aHeightFT, nOffset1 ); + MoveControl( aHeightED, nOffset1 ); + MoveControl( aRelHeightCB, nOffset1 ); + MoveControl( aFixedRatioCB, nOffset2 ); + + aWidthFT.Show(); + aWidthAutoFT.Hide(); + aAutoHeightCB.Hide(); + + aHeightFT.Show(); + aHeightAutoFT.Hide(); + aAutoWidthCB.Hide(); + + aRealSizeBT.Show(); + } +} + +void SwFrmPage::Reset( const SfxItemSet &rSet ) +{ + + SwWrtShell* pSh = bFormat ? ::GetActiveWrtShell() : + ((SwFrmDlg*)GetParent()->GetParent())->GetWrtShell(); + + nHtmlMode = ::GetHtmlMode(pSh->GetView().GetDocShell()); + bHtmlMode = nHtmlMode & HTMLMODE_ON ? sal_True : sal_False; + + FieldUnit aMetric = ::GetDfltMetric(bHtmlMode); + SetMetric( aWidthED, aMetric ); + SetMetric( aHeightED, aMetric ); + SetMetric( aAtHorzPosED, aMetric ); + SetMetric( aAtVertPosED, aMetric ); + + const SfxPoolItem* pItem = NULL; + + const SwFmtAnchor& rAnchor = (const SwFmtAnchor&)rSet.Get(RES_ANCHOR); + + if (SFX_ITEM_SET == rSet.GetItemState(FN_OLE_IS_MATH, sal_False, &pItem)) + m_bIsMathOLE = ((const SfxBoolItem*)pItem)->GetValue(); + if (SFX_ITEM_SET == rSet.GetItemState(FN_MATH_BASELINE_ALIGNMENT, sal_False, &pItem)) + m_bIsMathBaselineAlignment = ((const SfxBoolItem*)pItem)->GetValue(); + EnableVerticalPositioning( !(m_bIsMathOLE && m_bIsMathBaselineAlignment + && FLY_AS_CHAR == rAnchor.GetAnchorId()) ); + + if (bFormat) + { + // Bei Formaten keine Ankerbearbeitung + aAnchorAtPageRB.Enable( sal_False ); + aAnchorAtParaRB.Enable( sal_False ); + aAnchorAtCharRB.Enable( sal_False ); + aAnchorAsCharRB.Enable( sal_False ); + aAnchorAtFrameRB.Enable( sal_False ); + aTypeFL.Enable( sal_False ); + aFixedRatioCB.Enable(sal_False); + } + else + { + if (rAnchor.GetAnchorId() != FLY_AT_FLY && !pSh->IsFlyInFly()) + aAnchorAtFrameRB.Hide(); + // --> OD 2009-08-31 #mongolianlayout# +// if ( !bVerticalChanged && pSh->IsFrmVertical(sal_True, bIsInRightToLeft) ) + if ( pSh->IsFrmVertical( sal_True, bIsInRightToLeft, bIsVerticalL2R ) ) + // <-- + { + String sHLabel = aHorizontalFT.GetText(); + aHorizontalFT.SetText(aVerticalFT.GetText()); + aVerticalFT.SetText(sHLabel); + bIsVerticalFrame = sal_True; + } + } + + if ( nDlgType == DLG_FRM_GRF || nDlgType == DLG_FRM_OLE ) + { + ASSERT(pSh , "shell not found"); + //OS: nur fuer die Variante Einfuegen/Grafik/Eigenschaften + if(SFX_ITEM_SET == rSet.GetItemState(FN_PARAM_GRF_REALSIZE, sal_False, &pItem)) + aGrfSize = ((const SvxSizeItem*)pItem)->GetSize(); + else + pSh->GetGrfSize( aGrfSize ); + + if ( !bNew ) + { + aRealSizeBT.SetClickHdl(LINK(this, SwFrmPage, RealSizeHdl)); + EnableGraficMode(); + } +// else +// aTypeFL.SetSizePixel(Size(aTypeFL.GetSizePixel().Width(), aSizeFL.GetSizePixel().Height())); + + if ( nDlgType == DLG_FRM_GRF ) + aFixedRatioCB.Check( sal_False ); + else + { + if ( bNew ) + SetText( SW_RESSTR(STR_OLE_INSERT)); + else + SetText( SW_RESSTR(STR_OLE_EDIT)); + } + } + else + { +// aTypeFL.SetSizePixel(Size(aTypeFL.GetSizePixel().Width(), aSizeFL.GetSizePixel().Height())); + aGrfSize = ((const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE)).GetSize(); + } + + //Prozenteingabe ermoeglichen. + aWidthED. SetBaseValue( aWidthED.Normalize(aGrfSize.Width()), FUNIT_TWIP ); + aHeightED.SetBaseValue( aHeightED.Normalize(aGrfSize.Height()), FUNIT_TWIP ); + //the available space is not yet known so the RefValue has to be calculated from size and relative size values + //this is needed only if relative values are already set + + const SwFmtFrmSize& rFrmSize = (const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE); + + if (rFrmSize.GetWidthPercent() != 0xff && rFrmSize.GetWidthPercent() != 0) + { + //calculate the rerference value from the with and relative width values + sal_Int32 nSpace = rFrmSize.GetWidth() * 100 / rFrmSize.GetWidthPercent(); + aWidthED. SetRefValue( nSpace ); + } + + if (rFrmSize.GetHeightPercent() != 0xff && rFrmSize.GetHeightPercent() != 0) + { + //calculate the rerference value from the with and relative width values + sal_Int32 nSpace = rFrmSize.GetHeight() * 100 / rFrmSize.GetHeightPercent(); + aHeightED.SetRefValue( nSpace ); + } + + // Allgemeiner Initialisierungteil + switch(rAnchor.GetAnchorId()) + { + case FLY_AT_PAGE: aAnchorAtPageRB.Check(); break; + case FLY_AT_PARA: aAnchorAtParaRB.Check(); break; + case FLY_AT_CHAR: aAnchorAtCharRB.Check(); break; + case FLY_AS_CHAR: aAnchorAsCharRB.Check(); break; + case FLY_AT_FLY: aAnchorAtFrameRB.Check();break; + default:; //prevent warning + } + + // OD 12.11.2003 #i22341# - determine content position of character + // Note: content position can be NULL + mpToCharCntntPos = rAnchor.GetCntntAnchor(); + + // OD 19.09.2003 #i18732# - init checkbox value + { + const bool bFollowTextFlow = + static_cast<const SwFmtFollowTextFlow&>(rSet.Get(RES_FOLLOW_TEXT_FLOW)).GetValue(); + aFollowTextFlowCB.Check( bFollowTextFlow ); + } + + if(bHtmlMode) + { + if(nDlgType == DLG_FRM_STD && + 0 == (nHtmlMode & HTMLMODE_FULL_ABS_POS)) + { + aHeightFT .Enable( sal_False ); + aHeightED .Enable( sal_False ); + aRelHeightCB.Enable( sal_False ); + } + if( 0 == (nHtmlMode & HTMLMODE_SOME_ABS_POS)) + { + if (GetAnchor() == FLY_AT_PAGE) + { + aAnchorAtParaRB.Check(); + } + aAnchorAtPageRB.Enable(sal_False); + } + aAutoHeightCB.Enable(sal_False); + aAutoWidthCB.Enable(sal_False); + aMirrorPagesCB.Show(sal_False); + if(nDlgType == DLG_FRM_STD) + aFixedRatioCB.Enable(sal_False); + // OD 19.09.2003 #i18732# - hide checkbox in HTML mode + aFollowTextFlowCB.Show(sal_False); + } + else + { + // OD 06.11.2003 #i18732# correct enable/disable of check box 'Mirror on..' + aMirrorPagesCB.Enable(!aAnchorAsCharRB.IsChecked()); + + // OD 06.11.2003 #i18732# - enable/disable check box 'Follow text flow'. + // OD 10.11.2003 #i22305# - enable check box 'Follow text + // flow' also for anchor type to-frame. + aFollowTextFlowCB.Enable( aAnchorAtParaRB.IsChecked() || + aAnchorAtCharRB.IsChecked() || + aAnchorAtFrameRB.IsChecked() ); + } + + Init( rSet, sal_True ); + aAtVertPosED.SaveValue(); + aAtHorzPosED.SaveValue(); + // OD 19.09.2003 #i18732# + aFollowTextFlowCB.SaveValue(); + + bNoModifyHdl = sal_False; + //lock PercentFields + aWidthED.LockAutoCalculation(sal_True); + aHeightED.LockAutoCalculation(sal_True); + RangeModifyHdl(&aWidthED); // Alle Maximalwerte initial setzen + aHeightED.LockAutoCalculation(sal_False); + aWidthED.LockAutoCalculation(sal_False); + + aAutoHeightCB.SaveValue(); + aAutoWidthCB.SaveValue(); + + SwTwips nWidth = static_cast< SwTwips >(aWidthED.DenormalizePercent(aWidthED.GetValue(FUNIT_TWIP))); + SwTwips nHeight = static_cast< SwTwips >(aHeightED.DenormalizePercent(aHeightED.GetValue(FUNIT_TWIP))); + fWidthHeightRatio = nHeight ? double(nWidth) / double(nHeight) : 1.0; +} + + +/*-------------------------------------------------------------------- + Beschreibung: Attribute in den Set stopfen bei OK + --------------------------------------------------------------------*/ + +sal_Bool SwFrmPage::FillItemSet(SfxItemSet &rSet) +{ + sal_Bool bRet = sal_False; + SwWrtShell* pSh = bFormat ? ::GetActiveWrtShell() + : ((SwFrmDlg*)GetParent()->GetParent())->GetWrtShell(); + ASSERT( pSh , "shell not found"); + const SfxItemSet& rOldSet = GetItemSet(); + const SfxPoolItem* pOldItem = 0; + + RndStdIds eAnchorId = (RndStdIds)GetAnchor(); + + if ( !bFormat ) + { + pOldItem = GetOldItem(rSet, RES_ANCHOR); + if (bNew || !pOldItem || eAnchorId != ((const SwFmtAnchor*)pOldItem)->GetAnchorId()) + { + SwFmtAnchor aAnc( eAnchorId, pSh->GetPhyPageNum() ); + bRet = 0 != rSet.Put( aAnc ); + } + } + + if ( pHMap ) + { + SwFmtHoriOrient aHoriOrient( (const SwFmtHoriOrient&) + rOldSet.Get(RES_HORI_ORIENT) ); + + sal_uInt16 nMapPos = GetMapPos(pHMap, aHorizontalDLB); + short nAlign = GetAlignment(pHMap, nMapPos, aHorizontalDLB, aHoriRelationLB); + short nRel = GetRelation(pHMap, aHoriRelationLB); + + const sal_Int16 eHOri = nAlign; + const sal_Int16 eRel = nRel; + + aHoriOrient.SetHoriOrient( eHOri ); + aHoriOrient.SetRelationOrient( eRel ); + aHoriOrient.SetPosToggle(aMirrorPagesCB.IsChecked()); + + sal_Bool bMod = aAtHorzPosED.GetText() != aAtHorzPosED.GetSavedValue(); + bMod |= aMirrorPagesCB.GetState() != aMirrorPagesCB.GetSavedValue(); + + if ( eHOri == text::HoriOrientation::NONE && + (bNew || (bAtHorzPosModified || bMod) || nOldH != eHOri ) ) + { + SwTwips nX = static_cast< SwTwips >(aAtHorzPosED.Denormalize(aAtHorzPosED.GetValue(FUNIT_TWIP))); + aHoriOrient.SetPos( nX ); + } + + pOldItem = GetOldItem(rSet, FN_HORI_ORIENT); + sal_Bool bSame = sal_False; + if ((bNew == bFormat) && pOldItem) + { + bSame = static_cast< sal_Bool >(aHoriOrient == (SwFmtHoriOrient&)*pOldItem); + } + if ((bNew && !bFormat) || ((bAtHorzPosModified || bMod) && !bSame)) + { + bRet |= 0 != rSet.Put( aHoriOrient ); + } + } + + if ( pVMap ) + { + // Ausrichtung Vertikal + SwFmtVertOrient aVertOrient( (const SwFmtVertOrient&) + rOldSet.Get(RES_VERT_ORIENT) ); + + sal_uInt16 nMapPos = GetMapPos(pVMap, aVerticalDLB); + short nAlign = GetAlignment(pVMap, nMapPos, aVerticalDLB, aVertRelationLB); + short nRel = GetRelation(pVMap, aVertRelationLB); + + const sal_Int16 eVOri = nAlign; + const sal_Int16 eRel = nRel; + + aVertOrient.SetVertOrient ( eVOri); + aVertOrient.SetRelationOrient( eRel ); + + sal_Bool bMod = aAtVertPosED.GetText() != aAtVertPosED.GetSavedValue(); + + if ( eVOri == text::VertOrientation::NONE && + ( bNew || (bAtVertPosModified || bMod) || nOldV != eVOri) ) + { + // Vertikale Position + // fuer zeichengebundene Rahmen Offset umrechenen + SwTwips nY = static_cast< SwTwips >(aAtVertPosED.Denormalize(aAtVertPosED.GetValue(FUNIT_TWIP))); + if (eAnchorId == FLY_AS_CHAR) + { + nY *= -1; + } + aVertOrient.SetPos( nY ); + } + pOldItem = GetOldItem(rSet, FN_VERT_ORIENT); + sal_Bool bSame = sal_False; + if((bNew == bFormat) && pOldItem) + { + bSame = static_cast< sal_Bool >( bFormat ? + aVertOrient.GetVertOrient() == ((SwFmtVertOrient*)pOldItem)->GetVertOrient() && + aVertOrient.GetRelationOrient() == ((SwFmtVertOrient*)pOldItem)->GetRelationOrient() && + aVertOrient.GetPos() == ((SwFmtVertOrient*)pOldItem)->GetPos() + + : aVertOrient == (SwFmtVertOrient&)*pOldItem ); + } + if( ( bNew && !bFormat ) || ((bAtVertPosModified || bMod) && !bSame )) + { + bRet |= 0 != rSet.Put( aVertOrient ); + } + } + + //Size setzen + //Neuer Sonderfall: Ist die Groesse von pMgr(0, 0), so werden die + //Eigenschaften fuer eine Grafik festgelegt, die noch gar nicht geladen + //ist. Dann wird hier kein SetSize() gemacht, wenn die + //Groesseneinstellungen vom Anwender nicht veraendert wurden. + const SwFmtFrmSize& rOldSize = (const SwFmtFrmSize& )rOldSet.Get(RES_FRM_SIZE); + SwFmtFrmSize aSz( rOldSize ); + +/* // Folgende Zeilen nur zum debuggen: + sal_Bool bModified = aWidthED.IsValueModified(); + sal_uInt16 nOldWidth = rOldSize.GetWidth (); + sal_uInt16 nWidth = aWidthED .GetValue(); + sal_uInt16 nMinWidth = aWidthED .GetMin();*/ + + sal_Bool bValueModified = (aWidthED.IsValueModified() || aHeightED.IsValueModified()); + sal_Bool bCheckChanged = (aRelWidthCB.GetSavedValue() != aRelWidthCB.IsChecked() + || aRelHeightCB.GetSavedValue() != aRelHeightCB.IsChecked()); + + sal_Bool bLegalValue = !(!rOldSize.GetWidth () && !rOldSize.GetHeight() && + aWidthED .GetValue() == aWidthED .GetMin() && + aHeightED.GetValue() == aHeightED.GetMin()); + + if ((bNew && !bFormat) || ((bValueModified || bCheckChanged) && bLegalValue)) + { + sal_Int64 nNewWidth = aWidthED.DenormalizePercent(aWidthED.GetRealValue(FUNIT_TWIP)); + sal_Int64 nNewHeight = aHeightED.DenormalizePercent(aHeightED.GetRealValue(FUNIT_TWIP)); + aSz.SetWidth (static_cast< SwTwips >(nNewWidth)); + aSz.SetHeight(static_cast< SwTwips >(nNewHeight)); + + if (aRelWidthCB.IsChecked()) + { + aSz.SetWidthPercent((sal_uInt8)Min( static_cast< sal_Int64 >(MAX_PERCENT_WIDTH), aWidthED.Convert(aWidthED.NormalizePercent(nNewWidth), FUNIT_TWIP, FUNIT_CUSTOM))); + } + else + aSz.SetWidthPercent(0); + if (aRelHeightCB.IsChecked()) + aSz.SetHeightPercent((sal_uInt8)Min(static_cast< sal_Int64 >(MAX_PERCENT_HEIGHT), aHeightED.Convert(aHeightED.NormalizePercent(nNewHeight), FUNIT_TWIP, FUNIT_CUSTOM))); + else + aSz.SetHeightPercent(0); + + if (aFixedRatioCB.IsChecked() && (aRelWidthCB.IsChecked() ^ aRelHeightCB.IsChecked())) + { + if (aRelWidthCB.IsChecked()) + aSz.SetHeightPercent(0xff); + else + aSz.SetWidthPercent(0xff); + } + } + if( !IsInGraficMode() ) + { + if( aAutoHeightCB.GetState() != aAutoHeightCB.GetSavedValue() ) + { + SwFrmSize eFrmSize = (SwFrmSize) aAutoHeightCB.IsChecked()? ATT_MIN_SIZE : ATT_FIX_SIZE; + if( eFrmSize != aSz.GetHeightSizeType() ) + aSz.SetHeightSizeType(eFrmSize); + } + if( aAutoWidthCB.GetState() != aAutoWidthCB.GetSavedValue() ) + { + SwFrmSize eFrmSize = (SwFrmSize) aAutoWidthCB.IsChecked()? ATT_MIN_SIZE : ATT_FIX_SIZE; + if( eFrmSize != aSz.GetWidthSizeType() ) + aSz.SetWidthSizeType( eFrmSize ); + } + } + if( !bFormat && aFixedRatioCB.GetSavedValue() != aFixedRatioCB.IsChecked()) + bRet |= 0 != rSet.Put(SfxBoolItem(FN_KEEP_ASPECT_RATIO, aFixedRatioCB.IsChecked())); + + pOldItem = GetOldItem(rSet, RES_FRM_SIZE); + + if ((pOldItem && aSz != *pOldItem) || (!pOldItem && !bFormat) || + (bFormat && + (aSz.GetWidth() > 0 || aSz.GetWidthPercent() > 0) && + (aSz.GetHeight() > 0 || aSz.GetHeightPercent() > 0))) + { + if (aSz.GetHeightSizeType() == ATT_VAR_SIZE) // VAR_SIZE gibts nicht bei Rahmen + aSz.SetHeightSizeType(ATT_MIN_SIZE); // Bug #45776 (Vorlagen ohne Breite/Hoehe) + + bRet |= 0 != rSet.Put( aSz ); + } + // OD 19.09.2003 #i18732# + if(aFollowTextFlowCB.IsChecked() != aFollowTextFlowCB.GetSavedValue()) + { + bRet |= 0 != rSet.Put(SwFmtFollowTextFlow(aFollowTextFlowCB.IsChecked())); + } + return bRet; +} + +/*-------------------------------------------------------------------- + Beschreibung: Horizontale und vertikale Pos initialisieren + --------------------------------------------------------------------*/ + +void SwFrmPage::InitPos(RndStdIds eId, + sal_uInt16 nH, + sal_uInt16 nHRel, + sal_uInt16 nV, + sal_uInt16 nVRel, + long nX, + long nY) +{ + sal_uInt16 nPos = aVerticalDLB.GetSelectEntryPos(); + if ( nPos != LISTBOX_ENTRY_NOTFOUND && pVMap ) + { + nOldV = pVMap[nPos].nAlign; + + nPos = aVertRelationLB.GetSelectEntryPos(); + if (nPos != LISTBOX_ENTRY_NOTFOUND) + nOldVRel = ((RelationMap *)aVertRelationLB.GetEntryData(nPos))->nRelation; + } + + nPos = aHorizontalDLB.GetSelectEntryPos(); + if ( nPos != LISTBOX_ENTRY_NOTFOUND && pHMap ) + { + nOldH = pHMap[nPos].nAlign; + + nPos = aHoriRelationLB.GetSelectEntryPos(); + if (nPos != LISTBOX_ENTRY_NOTFOUND) + nOldHRel = ((RelationMap *)aHoriRelationLB.GetEntryData(nPos))->nRelation; + } + + sal_Bool bEnable = sal_True; + if ( eId == FLY_AT_PAGE ) + { + pVMap = bHtmlMode ? aVPageHtmlMap : aVPageMap; + pHMap = bHtmlMode ? aHPageHtmlMap : aHPageMap; + } + else if ( eId == FLY_AT_FLY ) + { + // OD 19.09.2003 #i18732# - own vertical alignment map for to frame + // anchored objects. + pVMap = bHtmlMode ? aVFlyHtmlMap : aVFrameMap; + pHMap = bHtmlMode ? aHFlyHtmlMap : aHFrameMap; + } + else if ( eId == FLY_AT_PARA ) + { + if(bHtmlMode) + { + pVMap = aVParaHtmlMap; + pHMap = nHtmlMode & HTMLMODE_SOME_ABS_POS ? aHParaHtmlAbsMap : aHParaHtmlMap; + } + else + { + pVMap = aVParaMap; + pHMap = aHParaMap; + } + } + else if ( eId == FLY_AT_CHAR ) + { + if(bHtmlMode) + { + pVMap = nHtmlMode & HTMLMODE_SOME_ABS_POS ? aVCharHtmlAbsMap : aVCharHtmlMap; + pHMap = nHtmlMode & HTMLMODE_SOME_ABS_POS ? aHCharHtmlAbsMap : aHCharHtmlMap; + } + else + { + pVMap = aVCharMap; + pHMap = aHCharMap; + } + } + else if ( eId == FLY_AS_CHAR ) + { + pVMap = bHtmlMode ? aVAsCharHtmlMap : aVAsCharMap; + pHMap = 0; + bEnable = sal_False; + } + aHorizontalDLB.Enable( bEnable ); + aHorizontalFT.Enable( bEnable ); + + // aktuelle Pos selektieren + // Horizontal + if ( nH == USHRT_MAX ) + { + nH = nOldH; + nHRel = nOldHRel; + } + // OD 12.11.2003 #i22341# - pass <nHRel> as 3rd parameter to method <FillPosLB> + sal_uInt16 nMapPos = FillPosLB(pHMap, nH, nHRel, aHorizontalDLB); + FillRelLB(pHMap, nMapPos, nH, nHRel, aHoriRelationLB, aHoriRelationFT); + + // Vertikal + if ( nV == USHRT_MAX ) + { + nV = nOldV; + nVRel = nOldVRel; + } + // OD 12.11.2003 #i22341# - pass <nVRel> as 3rd parameter to method <FillPosLB> + nMapPos = FillPosLB(pVMap, nV, nVRel, aVerticalDLB); + FillRelLB(pVMap, nMapPos, nV, nVRel, aVertRelationLB, aVertRelationFT); + + // Edits init + bEnable = nH == text::HoriOrientation::NONE && eId != FLY_AS_CHAR; + if (!bEnable) + { + aAtHorzPosED.SetValue( 0, FUNIT_TWIP ); + if (nX != LONG_MAX && bHtmlMode) + aAtHorzPosED.SetModifyFlag(); + } + else + { + if (nX != LONG_MAX) + aAtHorzPosED.SetValue( aAtHorzPosED.Normalize(nX), FUNIT_TWIP ); + } + aAtHorzPosFT.Enable( bEnable ); + aAtHorzPosED.Enable( bEnable ); + + bEnable = nV == text::VertOrientation::NONE; + if ( !bEnable ) + { + aAtVertPosED.SetValue( 0, FUNIT_TWIP ); + if(nY != LONG_MAX && bHtmlMode) + aAtVertPosED.SetModifyFlag(); + } + else + { + if ( eId == FLY_AS_CHAR ) + { + if ( nY == LONG_MAX ) + nY = 0; + else + nY *= -1; + } + if ( nY != LONG_MAX ) + aAtVertPosED.SetValue( aAtVertPosED.Normalize(nY), FUNIT_TWIP ); + } + aAtVertPosFT.Enable( bEnable && m_bAllowVertPositioning ); + aAtVertPosED.Enable( bEnable && m_bAllowVertPositioning ); + UpdateExample(); +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +sal_uInt16 SwFrmPage::FillPosLB(const FrmMap* _pMap, + const sal_uInt16 _nAlign, + const sal_uInt16 _nRel, + ListBox& _rLB ) +{ + String sSelEntry, sOldEntry; + sOldEntry = _rLB.GetSelectEntry(); + + _rLB.Clear(); + + // OD 12.11.2003 #i22341# - determine all possible listbox relations for + // given relation for map <aVCharMap> + const sal_uLong nLBRelations = (_pMap != aVCharMap) + ? 0L + : ::lcl_GetLBRelationsForRelations( _nRel ); + + // Listbox fuellen + size_t nCount = ::lcl_GetFrmMapCount(_pMap); + for (size_t i = 0; _pMap && i < nCount; ++i) + { +// #61359# Warum nicht von links/von innen bzw. von oben? +// if (!bFormat || (pMap[i].eStrId != SwFPos::FROMLEFT && pMap[i].eStrId != SwFPos::FROMTOP)) + { + SvxSwFramePosString::StringId eStrId = aMirrorPagesCB.IsChecked() ? _pMap[i].eMirrorStrId : _pMap[i].eStrId; + // --> OD 2009-08-31 #mongolianlayout# + eStrId = lcl_ChangeResIdToVerticalOrRTL( eStrId, + bIsVerticalFrame, + bIsVerticalL2R, + bIsInRightToLeft); + // <-- + String sEntry(aFramePosString.GetString(eStrId)); + if (_rLB.GetEntryPos(sEntry) == LISTBOX_ENTRY_NOTFOUND) + { + // bei zeichengebundenen Rahmen keine doppelten Eintraege einfuegen + _rLB.InsertEntry(sEntry); + } + // OD 12.11.2003 #i22341# - add condition to handle map <aVCharMap> + // that is ambigous in the alignment. + if ( _pMap[i].nAlign == _nAlign && + ( !(_pMap == aVCharMap) || _pMap[i].nLBRelations & nLBRelations ) ) + { + sSelEntry = sEntry; + } + } + } + + _rLB.SelectEntry(sSelEntry); + if (!_rLB.GetSelectEntryCount()) + _rLB.SelectEntry(sOldEntry); + + if (!_rLB.GetSelectEntryCount()) + _rLB.SelectEntryPos(0); + + PosHdl(&_rLB); + + return GetMapPos(_pMap, _rLB); +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ +sal_uLong SwFrmPage::FillRelLB( const FrmMap* _pMap, + const sal_uInt16 _nLBSelPos, + const sal_uInt16 _nAlign, + sal_uInt16 _nRel, + ListBox& _rLB, + FixedText& _rFT ) +{ + String sSelEntry; + sal_uLong nLBRelations = 0; + size_t nMapCount = ::lcl_GetFrmMapCount(_pMap); + + _rLB.Clear(); + + if (_nLBSelPos < nMapCount) + { + if (_pMap == aVAsCharHtmlMap || _pMap == aVAsCharMap) + { + String sOldEntry(_rLB.GetSelectEntry()); + sal_uInt16 nRelCount = sizeof(aAsCharRelationMap) / sizeof(RelationMap); + SvxSwFramePosString::StringId eStrId = _pMap[_nLBSelPos].eStrId; + + for (size_t nMapPos = 0; nMapPos < nMapCount; nMapPos++) + { + if (_pMap[nMapPos].eStrId == eStrId) + { + nLBRelations = _pMap[nMapPos].nLBRelations; + for (sal_uInt16 nRelPos = 0; nRelPos < nRelCount; nRelPos++) + { + if (nLBRelations & aAsCharRelationMap[nRelPos].nLBRelation) + { + SvxSwFramePosString::StringId sStrId1 = aAsCharRelationMap[nRelPos].eStrId; + + // --> OD 2009-08-31 #mongolianlayout# + sStrId1 = + lcl_ChangeResIdToVerticalOrRTL( sStrId1, + bIsVerticalFrame, + bIsVerticalL2R, + bIsInRightToLeft); + // <-- + String sEntry = aFramePosString.GetString(sStrId1); + sal_uInt16 nPos = _rLB.InsertEntry(sEntry); + _rLB.SetEntryData(nPos, &aAsCharRelationMap[nRelPos]); + if (_pMap[nMapPos].nAlign == _nAlign) + sSelEntry = sEntry; + break; + } + } + } + } + if (sSelEntry.Len()) + _rLB.SelectEntry(sSelEntry); + else + { + _rLB.SelectEntry(sOldEntry); + + if (!_rLB.GetSelectEntryCount()) + { + for (sal_uInt16 i = 0; i < _rLB.GetEntryCount(); i++) + { + RelationMap *pEntry = (RelationMap *)_rLB.GetEntryData(i); + if (pEntry->nLBRelation == LB_REL_CHAR) // Default + { + _rLB.SelectEntryPos(i); + break; + } + } + } + } + } + else + { + sal_uInt16 nRelCount = sizeof(aRelationMap) / sizeof(RelationMap); + + // OD 14.11.2003 #i22341# - special handling for map <aVCharMap>, + // because its ambigous in its <eStrId>/<eMirrorStrId>. + if ( _pMap == aVCharMap ) + { + nLBRelations = ::lcl_GetLBRelationsForStrID( _pMap, + ( aMirrorPagesCB.IsChecked() + ? _pMap[_nLBSelPos].eMirrorStrId + : _pMap[_nLBSelPos].eStrId), + aMirrorPagesCB.IsChecked() ); + } + else + { + nLBRelations = _pMap[_nLBSelPos].nLBRelations; + } + + for (sal_uLong nBit = 1; nBit < 0x80000000; nBit <<= 1) + { + if (nLBRelations & nBit) + { + for (sal_uInt16 nRelPos = 0; nRelPos < nRelCount; nRelPos++) + { + if (aRelationMap[nRelPos].nLBRelation == nBit) + { + SvxSwFramePosString::StringId eStrId1 = aMirrorPagesCB.IsChecked() ? + aRelationMap[nRelPos].eMirrorStrId : aRelationMap[nRelPos].eStrId; + // --> OD 2009-08-31 #mongolianlayout# + eStrId1 = + lcl_ChangeResIdToVerticalOrRTL( eStrId1, + bIsVerticalFrame, + bIsVerticalL2R, + bIsInRightToLeft); + // <-- + String sEntry = aFramePosString.GetString(eStrId1); + sal_uInt16 nPos = _rLB.InsertEntry(sEntry); + _rLB.SetEntryData(nPos, &aRelationMap[nRelPos]); + if (!sSelEntry.Len() && aRelationMap[nRelPos].nRelation == _nRel) + sSelEntry = sEntry; + } + } + } + } + if (sSelEntry.Len()) + _rLB.SelectEntry(sSelEntry); + else + { + // Warscheinlich Ankerwechsel. Daher aehnliche Relation suchen + switch (_nRel) + { + case text::RelOrientation::FRAME: _nRel = text::RelOrientation::PAGE_FRAME; break; + case text::RelOrientation::PRINT_AREA: _nRel = text::RelOrientation::PAGE_PRINT_AREA; break; + case text::RelOrientation::PAGE_LEFT: _nRel = text::RelOrientation::FRAME_LEFT; break; + case text::RelOrientation::PAGE_RIGHT: _nRel = text::RelOrientation::FRAME_RIGHT; break; + case text::RelOrientation::FRAME_LEFT: _nRel = text::RelOrientation::PAGE_LEFT; break; + case text::RelOrientation::FRAME_RIGHT: _nRel = text::RelOrientation::PAGE_RIGHT; break; + case text::RelOrientation::PAGE_FRAME: _nRel = text::RelOrientation::FRAME; break; + case text::RelOrientation::PAGE_PRINT_AREA: _nRel = text::RelOrientation::PRINT_AREA; break; + + default: + if (_rLB.GetEntryCount()) + { + RelationMap *pEntry = (RelationMap *)_rLB.GetEntryData(_rLB.GetEntryCount() - 1); + _nRel = pEntry->nRelation; + } + break; + } + + for (sal_uInt16 i = 0; i < _rLB.GetEntryCount(); i++) + { + RelationMap *pEntry = (RelationMap *)_rLB.GetEntryData(i); + if (pEntry->nRelation == _nRel) + { + _rLB.SelectEntryPos(i); + break; + } + } + + if (!_rLB.GetSelectEntryCount()) + _rLB.SelectEntryPos(0); + } + } + } + + const bool bEnable = _rLB.GetEntryCount() != 0 + && (&_rLB != &aVertRelationLB || m_bAllowVertPositioning); + _rLB.Enable( bEnable ); + _rFT.Enable( bEnable ); + + RelHdl(&_rLB); + + return nLBRelations; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +short SwFrmPage::GetRelation(FrmMap * /*pMap*/, ListBox &rRelationLB) +{ + short nRel = 0; + sal_uInt16 nPos = rRelationLB.GetSelectEntryPos(); + + if (nPos != LISTBOX_ENTRY_NOTFOUND) + { + RelationMap *pEntry = (RelationMap *)rRelationLB.GetEntryData(nPos); + nRel = pEntry->nRelation; + } + + return nRel; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +short SwFrmPage::GetAlignment(FrmMap *pMap, sal_uInt16 nMapPos, + ListBox &/*rAlignLB*/, ListBox &rRelationLB) +{ + short nAlign = 0; + + // OD 14.11.2003 #i22341# - special handling also for map <aVCharMap>, + // because it contains ambigous items for alignment + if ( pMap == aVAsCharHtmlMap || pMap == aVAsCharMap || + pMap == aVCharMap ) + { + if (rRelationLB.GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND) + { + sal_uLong nRel = ((RelationMap *)rRelationLB.GetEntryData(rRelationLB.GetSelectEntryPos()))->nLBRelation; + size_t nMapCount = ::lcl_GetFrmMapCount(pMap); + SvxSwFramePosString::StringId eStrId = pMap[nMapPos].eStrId; + + for (size_t i = 0; i < nMapCount; i++) + { + if (pMap[i].eStrId == eStrId) + { + sal_uLong nLBRelations = pMap[i].nLBRelations; + if (nLBRelations & nRel) + { + nAlign = pMap[i].nAlign; + break; + } + } + } + } + } + else if (pMap) + nAlign = pMap[nMapPos].nAlign; + + return nAlign; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +sal_uInt16 SwFrmPage::GetMapPos( const FrmMap *pMap, ListBox &rAlignLB ) +{ + sal_uInt16 nMapPos = 0; + sal_uInt16 nLBSelPos = rAlignLB.GetSelectEntryPos(); + + if (nLBSelPos != LISTBOX_ENTRY_NOTFOUND) + { + if (pMap == aVAsCharHtmlMap || pMap == aVAsCharMap) + { + size_t nMapCount = ::lcl_GetFrmMapCount(pMap); + String sSelEntry(rAlignLB.GetSelectEntry()); + + for (size_t i = 0; i < nMapCount; i++) + { + SvxSwFramePosString::StringId eResId = pMap[i].eStrId; + + String sEntry = aFramePosString.GetString(eResId); + sEntry = MnemonicGenerator::EraseAllMnemonicChars( sEntry ); + + if (sEntry == sSelEntry) + { + nMapPos = static_cast< sal_uInt16 >(i); + break; + } + } + } + else + nMapPos = nLBSelPos; + } + + return nMapPos; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +RndStdIds SwFrmPage::GetAnchor() +{ + RndStdIds nRet = FLY_AT_PAGE; + if(aAnchorAtParaRB.IsChecked()) + { + nRet = FLY_AT_PARA; + } + else if(aAnchorAtCharRB.IsChecked()) + { + nRet = FLY_AT_CHAR; + } + else if(aAnchorAsCharRB.IsChecked()) + { + nRet = FLY_AS_CHAR; + } + else if(aAnchorAtFrameRB.IsChecked()) + { + nRet = FLY_AT_FLY; + } + return nRet; +} + +/*-------------------------------------------------------------------- + Beschreibung: Bsp - Update + --------------------------------------------------------------------*/ + +void SwFrmPage::ActivatePage(const SfxItemSet& rSet) +{ + bNoModifyHdl = sal_True; + Init(rSet); + bNoModifyHdl = sal_False; + //lock PercentFields + aWidthED.LockAutoCalculation(sal_True); + aHeightED.LockAutoCalculation(sal_True); + RangeModifyHdl(&aWidthED); // Alle Maximalwerte initial setzen + aHeightED.LockAutoCalculation(sal_False); + aWidthED.LockAutoCalculation(sal_False); + aFollowTextFlowCB.SaveValue(); +} + +int SwFrmPage::DeactivatePage(SfxItemSet * _pSet) +{ + if ( _pSet ) + { + FillItemSet( *_pSet ); + + //FillItemSet setzt den Anker nicht in den Set, wenn er mit dem + //Original uebereinstimmt. Fuer die anderen Pages brauchen wir aber + //den aktuellen Anker. + SwWrtShell* pSh = bFormat ? ::GetActiveWrtShell() + : ((SwFrmDlg*)GetParent()->GetParent())->GetWrtShell(); + RndStdIds eAnchorId = (RndStdIds)GetAnchor(); + SwFmtAnchor aAnc( eAnchorId, pSh->GetPhyPageNum() ); + _pSet->Put( aAnc ); + } + + return sal_True; +} + +/*-------------------------------------------------------------------- + Beschreibung: Links/rechts mit Innen/aussen tauschen + --------------------------------------------------------------------*/ + +IMPL_LINK( SwFrmPage, MirrorHdl, CheckBox *, EMPTYARG ) +{ + RndStdIds eId = GetAnchor(); + InitPos( eId, USHRT_MAX, 0, USHRT_MAX, 0, LONG_MAX, LONG_MAX); + + return 0; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +IMPL_LINK( SwFrmPage, RelSizeClickHdl, CheckBox *, pBtn ) +{ + if (pBtn == &aRelWidthCB) + { + aWidthED.ShowPercent(pBtn->IsChecked()); + if(pBtn->IsChecked()) + aWidthED.MetricField::SetMax(MAX_PERCENT_WIDTH); + } + else // pBtn == &aRelHeightCB + { + aHeightED.ShowPercent(pBtn->IsChecked()); + if(pBtn->IsChecked()) + aHeightED.MetricField::SetMax(MAX_PERCENT_HEIGHT); + } + + if (pBtn) // Nur wenn Handler durch Aenderung des Controllers gerufen wurde + RangeModifyHdl(&aWidthED); // Werte wieder korrigieren + + if (pBtn == &aRelWidthCB) + ModifyHdl(&aWidthED); + else // pBtn == &aRelHeightCB + ModifyHdl(&aHeightED); + + return 0; +} + +/*-------------------------------------------------------------------- + Beschreibung: Bereichspruefung + --------------------------------------------------------------------*/ + +IMPL_LINK( SwFrmPage, RangeModifyHdl, Edit *, EMPTYARG ) +{ + if (bNoModifyHdl) + return 0; + + SwWrtShell* pSh = bFormat ? ::GetActiveWrtShell() + :((SwFrmDlg*)GetParent()->GetParent())->GetWrtShell(); + ASSERT(pSh , "shell not found"); + SwFlyFrmAttrMgr aMgr( bNew, pSh, (const SwAttrSet&)GetItemSet() ); + SvxSwFrameValidation aVal; + + aVal.nAnchorType = static_cast< sal_uInt16 >(GetAnchor()); + aVal.bAutoHeight = aAutoHeightCB.IsChecked(); + aVal.bAutoWidth = aAutoWidthCB.IsChecked(); + aVal.bMirror = aMirrorPagesCB.IsChecked(); + // OD 18.09.2003 #i18732# + aVal.bFollowTextFlow = aFollowTextFlowCB.IsChecked(); + + if ( pHMap ) + { + // Ausrichtung Horizontal + sal_uInt16 nMapPos = GetMapPos(pHMap, aHorizontalDLB); + short nAlign = GetAlignment(pHMap, nMapPos, aHorizontalDLB, aHoriRelationLB); + short nRel = GetRelation(pHMap, aHoriRelationLB); + + aVal.nHoriOrient = nAlign; + aVal.nHRelOrient = nRel; + } + else + aVal.nHoriOrient = text::HoriOrientation::NONE; + + if ( pVMap ) + { + // Ausrichtung Vertikal + sal_uInt16 nMapPos = GetMapPos(pVMap, aVerticalDLB); + short nAlign = GetAlignment(pVMap, nMapPos, aVerticalDLB, aVertRelationLB); + short nRel = GetRelation(pVMap, aVertRelationLB); + + aVal.nVertOrient = nAlign; + aVal.nVRelOrient = nRel; + } + else + aVal.nVertOrient = text::VertOrientation::NONE; + + const long nAtHorzPosVal = static_cast< long >( + aAtHorzPosED.Denormalize(aAtHorzPosED.GetValue(FUNIT_TWIP)) ); + const long nAtVertPosVal = static_cast< long >( + aAtVertPosED.Denormalize(aAtVertPosED.GetValue(FUNIT_TWIP)) ); + + aVal.nHPos = nAtHorzPosVal; + aVal.nVPos = nAtVertPosVal; + + aMgr.ValidateMetrics(aVal, mpToCharCntntPos, sal_True); // Einmal, um Referenzwerte fuer prozentuale Werte zu erhalten + + // Referenzwerte fuer fuer Prozentwerte setzen (100%) ... + aWidthED.SetRefValue(aVal.aPercentSize.Width()); + aHeightED.SetRefValue(aVal.aPercentSize.Height()); + + // ... und damit Breite und Hoehe korrekt umrechnen + SwTwips nWidth = static_cast< SwTwips >(aWidthED. DenormalizePercent(aWidthED.GetValue(FUNIT_TWIP))); + SwTwips nHeight = static_cast< SwTwips >(aHeightED.DenormalizePercent(aHeightED.GetValue(FUNIT_TWIP))); + aVal.nWidth = nWidth; + aVal.nHeight = nHeight; + + aMgr.ValidateMetrics(aVal, mpToCharCntntPos); // Nochmal um mit korrekter Breite und Hoehe alle restlichen Werte zu ermitteln + + // alle Spalten muessen passen + if(GetTabDialog()->GetExampleSet() && + SFX_ITEM_DEFAULT <= GetTabDialog()->GetExampleSet()->GetItemState(RES_COL)) + { + const SwFmtCol& rCol = (const SwFmtCol&)GetTabDialog()->GetExampleSet()->Get(RES_COL); + if ( rCol.GetColumns().Count() > 1 ) + { + for ( sal_uInt16 i = 0; i < rCol.GetColumns().Count(); ++i ) + { + aVal.nMinWidth += rCol.GetColumns()[i]->GetLeft() + + rCol.GetColumns()[i]->GetRight() + + MINFLY; + } + aVal.nMinWidth -= MINFLY;//einen hatten wir schon mit drin! + } + } + + nWidth = aVal.nWidth; + nHeight = aVal.nHeight; + + // Mindestbreite auch fuer Vorlage + aHeightED.SetMin(aHeightED.NormalizePercent(aVal.nMinHeight), FUNIT_TWIP); + aWidthED. SetMin(aWidthED.NormalizePercent(aVal.nMinWidth), FUNIT_TWIP); + + SwTwips nMaxWidth(aVal.nMaxWidth); + SwTwips nMaxHeight(aVal.nMaxHeight); + + if (aVal.bAutoHeight && (nDlgType == DLG_FRM_GRF || nDlgType == DLG_FRM_OLE)) + { + SwTwips nTmp = Min(nWidth * nMaxHeight / Max(nHeight, 1L), nMaxHeight); + aWidthED.SetMax(aWidthED.NormalizePercent(nTmp), FUNIT_TWIP); + + nTmp = Min(nHeight * nMaxWidth / Max(nWidth, 1L), nMaxWidth); + aHeightED.SetMax(aWidthED.NormalizePercent(nTmp), FUNIT_TWIP); + } + else + { + SwTwips nTmp = static_cast< SwTwips >(aHeightED.NormalizePercent(nMaxHeight)); + aHeightED.SetMax(nTmp, FUNIT_TWIP); + + nTmp = static_cast< SwTwips >(aWidthED.NormalizePercent(nMaxWidth)); + aWidthED.SetMax(nTmp, FUNIT_TWIP); + } + + aAtHorzPosED.SetMin(aAtHorzPosED.Normalize(aVal.nMinHPos), FUNIT_TWIP); + aAtHorzPosED.SetMax(aAtHorzPosED.Normalize(aVal.nMaxHPos), FUNIT_TWIP); + if ( aVal.nHPos != nAtHorzPosVal ) + aAtHorzPosED.SetValue(aAtHorzPosED.Normalize(aVal.nHPos), FUNIT_TWIP); + + const SwTwips nUpperOffset = (aVal.nAnchorType == FLY_AS_CHAR) + ? nUpperBorder : 0; + const SwTwips nLowerOffset = (aVal.nAnchorType == FLY_AS_CHAR) + ? nLowerBorder : 0; + + aAtVertPosED.SetMin(aAtVertPosED.Normalize(aVal.nMinVPos + nLowerOffset + nUpperOffset), FUNIT_TWIP); + aAtVertPosED.SetMax(aAtVertPosED.Normalize(aVal.nMaxVPos), FUNIT_TWIP); + if ( aVal.nVPos != nAtVertPosVal ) + aAtVertPosED.SetValue(aAtVertPosED.Normalize(aVal.nVPos), FUNIT_TWIP); + + return 0; +} + +IMPL_LINK( SwFrmPage, AnchorTypeHdl, RadioButton *, EMPTYARG ) +{ + aMirrorPagesCB.Enable(!aAnchorAsCharRB.IsChecked()); + + // OD 06.11.2003 #i18732# - enable check box 'Follow text flow' for anchor + // type to-paragraph' and to-character + // OD 10.11.2003 #i22305# - enable check box 'Follow text + // flow' also for anchor type to-frame. + aFollowTextFlowCB.Enable( aAnchorAtParaRB.IsChecked() || + aAnchorAtCharRB.IsChecked() || + aAnchorAtFrameRB.IsChecked() ); + + RndStdIds eId = GetAnchor(); + + InitPos( eId, USHRT_MAX, 0, USHRT_MAX, 0, LONG_MAX, LONG_MAX); + RangeModifyHdl(0); + + if(bHtmlMode) + { + PosHdl(&aHorizontalDLB); + PosHdl(&aVerticalDLB); + } + + EnableVerticalPositioning( !(m_bIsMathOLE && m_bIsMathBaselineAlignment + && FLY_AS_CHAR == eId) ); + + return 0; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +IMPL_LINK( SwFrmPage, PosHdl, ListBox *, pLB ) +{ + sal_Bool bHori = pLB == &aHorizontalDLB; + ListBox *pRelLB = bHori ? &aHoriRelationLB : &aVertRelationLB; + FixedText *pRelFT = bHori ? &aHoriRelationFT : &aVertRelationFT; + FrmMap *pMap = bHori ? pHMap : pVMap; + + sal_uInt16 nMapPos = GetMapPos(pMap, *pLB); + short nAlign = GetAlignment(pMap, nMapPos, *pLB, *pRelLB); + + if (bHori) + { + sal_Bool bEnable = text::HoriOrientation::NONE == nAlign; + aAtHorzPosED.Enable( bEnable ); + aAtHorzPosFT.Enable( bEnable ); + } + else + { + sal_Bool bEnable = text::VertOrientation::NONE == nAlign && m_bAllowVertPositioning; + aAtVertPosED.Enable( bEnable ); + aAtVertPosFT.Enable( bEnable ); + } + + if (pLB) // Nur wenn Handler durch Aenderung des Controllers gerufen wurde + RangeModifyHdl( 0 ); + + sal_uInt16 nRel = 0; + if (pLB->GetSelectEntryCount()) + { + + if (pRelLB->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND) + nRel = ((RelationMap *)pRelLB->GetEntryData(pRelLB->GetSelectEntryPos()))->nRelation; + + FillRelLB(pMap, nMapPos, nAlign, nRel, *pRelLB, *pRelFT); + } + else + pRelLB->Clear(); + + UpdateExample(); + + if (bHori) + bAtHorzPosModified = sal_True; + else + bAtVertPosModified = sal_True; + + // Sonderbehandlung fuer HTML-Mode mit horz-vert-Abhaengigkeiten + if(bHtmlMode && nHtmlMode&HTMLMODE_SOME_ABS_POS && + (FLY_AT_CHAR == GetAnchor())) + { + sal_Bool bSet = sal_False; + if(bHori) + { + // rechts ist nur unterhalb erlaubt - von links nur oben + // von links am Zeichen -> unterhalb + if((text::HoriOrientation::LEFT == nAlign || text::HoriOrientation::RIGHT == nAlign) && + 0 == aVerticalDLB.GetSelectEntryPos()) + { + if(text::RelOrientation::FRAME == nRel) + aVerticalDLB.SelectEntryPos(1); + else + aVerticalDLB.SelectEntryPos(0); + bSet = sal_True; + } + else if(text::HoriOrientation::LEFT == nAlign && 1 == aVerticalDLB.GetSelectEntryPos()) + { + aVerticalDLB.SelectEntryPos(0); + bSet = sal_True; + } + else if(text::HoriOrientation::NONE == nAlign && 1 == aVerticalDLB.GetSelectEntryPos()) + { + aVerticalDLB.SelectEntryPos(0); + bSet = sal_True; + } + if(bSet) + PosHdl(&aVerticalDLB); + } + else + { + if(text::VertOrientation::TOP == nAlign) + { + if(1 == aHorizontalDLB.GetSelectEntryPos()) + { + aHorizontalDLB.SelectEntryPos(0); + bSet = sal_True; + } + aHoriRelationLB.SelectEntryPos(1); + } + else if(text::VertOrientation::CHAR_BOTTOM == nAlign) + { + if(2 == aHorizontalDLB.GetSelectEntryPos()) + { + aHorizontalDLB.SelectEntryPos(0); + bSet = sal_True; + } + aHoriRelationLB.SelectEntryPos(0) ; + } + if(bSet) + PosHdl(&aHorizontalDLB); + } + + } + return 0; +} + +/*-------------------------------------------------------------------- + Beschreibung: Horizontale Pos + --------------------------------------------------------------------*/ + +IMPL_LINK( SwFrmPage, RelHdl, ListBox *, pLB ) +{ + sal_Bool bHori = pLB == &aHoriRelationLB; + + UpdateExample(); + + if (bHori) + bAtHorzPosModified = sal_True; + else + bAtVertPosModified = sal_True; + + if (bHtmlMode && (FLY_AT_CHAR == GetAnchor())) + { + if(bHori) + { + sal_uInt16 nRel = GetRelation(pHMap, aHoriRelationLB); + if(text::RelOrientation::PRINT_AREA == nRel && 0 == aVerticalDLB.GetSelectEntryPos()) + { + aVerticalDLB.SelectEntryPos(1); + } + else if(text::RelOrientation::CHAR == nRel && 1 == aVerticalDLB.GetSelectEntryPos()) + { + aVerticalDLB.SelectEntryPos(0); + } + } + } + if (pLB) // Nur wenn Handler durch Aenderung des Controllers gerufen wurde + RangeModifyHdl(0); + + return 0; +} + + +IMPL_LINK_INLINE_START( SwFrmPage, RealSizeHdl, Button *, EMPTYARG ) +{ + aWidthED.SetUserValue( aWidthED. NormalizePercent(aGrfSize.Width() ), FUNIT_TWIP); + aHeightED.SetUserValue(aHeightED.NormalizePercent(aGrfSize.Height()), FUNIT_TWIP); + fWidthHeightRatio = aGrfSize.Height() ? double(aGrfSize.Width()) / double(aGrfSize.Height()) : 1.0; + UpdateExample(); + return 0; +} +IMPL_LINK_INLINE_END( SwFrmPage, RealSizeHdl, Button *, EMPTYARG ) + + +IMPL_LINK( SwFrmPage, AutoWidthClickHdl, void*, EMPTYARG ) +{ + if( !IsInGraficMode() ) + HandleAutoCB( aAutoWidthCB.IsChecked(), aWidthFT, aWidthAutoFT ); + return 0; +} + +IMPL_LINK( SwFrmPage, AutoHeightClickHdl, void*, EMPTYARG ) +{ + if( !IsInGraficMode() ) + HandleAutoCB( aAutoHeightCB.IsChecked(), aHeightFT, aHeightAutoFT ); + return 0; +} + +IMPL_LINK( SwFrmPage, ModifyHdl, Edit *, pEdit ) +{ + SwTwips nWidth = static_cast< SwTwips >(aWidthED.DenormalizePercent(aWidthED.GetValue(FUNIT_TWIP))); + SwTwips nHeight = static_cast< SwTwips >(aHeightED.DenormalizePercent(aHeightED.GetValue(FUNIT_TWIP))); + if ( aFixedRatioCB.IsChecked() ) + { + if ( pEdit == &aWidthED ) + { + nHeight = SwTwips((double)nWidth / fWidthHeightRatio); + aHeightED.SetPrcntValue(aHeightED.NormalizePercent(nHeight), FUNIT_TWIP); + } + else if(pEdit == &aHeightED) + { + nWidth = SwTwips((double)nHeight * fWidthHeightRatio); + aWidthED.SetPrcntValue(aWidthED.NormalizePercent(nWidth), FUNIT_TWIP); + } + } + fWidthHeightRatio = nHeight ? double(nWidth) / double(nHeight) : 1.0; + UpdateExample(); + return 0; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +void SwFrmPage::UpdateExample() +{ + sal_uInt16 nPos = aHorizontalDLB.GetSelectEntryPos(); + if ( pHMap && nPos != LISTBOX_ENTRY_NOTFOUND ) + { + sal_uInt16 nMapPos = GetMapPos(pHMap, aHorizontalDLB); + short nAlign = GetAlignment(pHMap, nMapPos, aHorizontalDLB, aHoriRelationLB); + short nRel = GetRelation(pHMap, aHoriRelationLB); + + aExampleWN.SetHAlign(nAlign); + aExampleWN.SetHoriRel(nRel); + } + + nPos = aVerticalDLB.GetSelectEntryPos(); + if ( pVMap && nPos != LISTBOX_ENTRY_NOTFOUND ) + { + sal_uInt16 nMapPos = GetMapPos(pVMap, aVerticalDLB); + short nAlign = GetAlignment(pVMap, nMapPos, aVerticalDLB, aVertRelationLB); + short nRel = GetRelation(pVMap, aVertRelationLB); + + aExampleWN.SetVAlign(nAlign); + aExampleWN.SetVertRel(nRel); + } + + // Size + long nXPos = static_cast< long >(aAtHorzPosED.Denormalize(aAtHorzPosED.GetValue(FUNIT_TWIP))); + long nYPos = static_cast< long >(aAtVertPosED.Denormalize(aAtVertPosED.GetValue(FUNIT_TWIP))); + aExampleWN.SetRelPos(Point(nXPos, nYPos)); + + aExampleWN.SetAnchor( static_cast< sal_uInt16 >(GetAnchor()) ); + aExampleWN.Invalidate(); +} + +void SwFrmPage::Init(const SfxItemSet& rSet, sal_Bool bReset) +{ + if(!bFormat) + { + SwWrtShell* pSh = ((SwFrmDlg*)GetParent()->GetParent())->GetWrtShell(); + + // Size + const sal_Bool bSizeFixed = pSh->IsSelObjProtected( FLYPROTECT_FIXED ); + + aWidthED .Enable( !bSizeFixed ); + aHeightED.Enable( !bSizeFixed ); + + // size controls for math OLE objects + if ( DLG_FRM_OLE == nDlgType && ! bNew ) + { + // disable width and height for math objects + const SvGlobalName& rFactNm( pSh->GetOLEObject()->getClassID() ); + + struct _GlobalNameId { + sal_uInt32 n1; + sal_uInt16 n2, n3; + sal_uInt8 b8, b9, b10, b11, b12, b13, b14, b15; + } aGlbNmIds[4] = { { SO3_SM_CLASSID_60 }, { SO3_SM_CLASSID_50 }, + { SO3_SM_CLASSID_40 }, { SO3_SM_CLASSID_30 } }; + + for ( int i = 0; i < 4; ++i ) { + const _GlobalNameId& rId = aGlbNmIds[ i ]; + + SvGlobalName aGlbNm( rId.n1, rId.n2, rId.n3, + rId.b8, rId.b9, rId.b10, rId.b11, + rId.b12, rId.b13, rId.b14, rId.b15 ); + + if( rFactNm == aGlbNm ) + { + // disable size controls for math OLE objects + aWidthFT.Disable(); + aWidthED.Disable(); + aRelWidthCB.Disable(); + aHeightFT.Disable(); + aHeightED.Disable(); + aRelHeightCB.Disable(); + aFixedRatioCB.Disable(); + aRealSizeBT.Disable(); + break; + } + } + + // TODO/LATER: get correct aspect + if(0 != (pSh->GetOLEObject()->getStatus( embed::Aspects::MSOLE_CONTENT ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE ) ) + aRealSizeBT.Disable(); + } + } + + const SwFmtFrmSize& rSize = (const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE); + sal_Int64 nWidth = aWidthED.NormalizePercent(rSize.GetWidth()); + sal_Int64 nHeight = aHeightED.NormalizePercent(rSize.GetHeight()); + + if (nWidth != aWidthED.GetValue(FUNIT_TWIP)) + { + if(!bReset) + { + // Wert wurde von Umlauf-Tabpage geaendert und muss + // mit Modify-Flag gesetzt werden + aWidthED.SetUserValue(nWidth, FUNIT_TWIP); + } + else + aWidthED.SetPrcntValue(nWidth, FUNIT_TWIP); + } + + if (nHeight != aHeightED.GetValue(FUNIT_TWIP)) + { + if (!bReset) + { + // Wert wurde von Umlauf-Tabpage geaendert und muss + // mit Modify-Flag gesetzt werden + aHeightED.SetUserValue(nHeight, FUNIT_TWIP); + } + else + aHeightED.SetPrcntValue(nHeight, FUNIT_TWIP); + } + + if (!IsInGraficMode()) + { + SwFrmSize eSize = rSize.GetHeightSizeType(); + sal_Bool bCheck = eSize != ATT_FIX_SIZE; + aAutoHeightCB.Check( bCheck ); + HandleAutoCB( bCheck, aHeightFT, aHeightAutoFT ); + if( eSize == ATT_VAR_SIZE ) + aHeightED.SetValue( aHeightED.GetMin(), FUNIT_NONE ); + + eSize = rSize.GetWidthSizeType(); + bCheck = eSize != ATT_FIX_SIZE; + aAutoWidthCB.Check( bCheck ); + HandleAutoCB( bCheck, aWidthFT, aWidthAutoFT ); + if( eSize == ATT_VAR_SIZE ) + aWidthED.SetValue( aWidthED.GetMin(), FUNIT_NONE ); + + if ( !bFormat ) + { + SwWrtShell* pSh = ((SwFrmDlg*)GetParent()->GetParent())->GetWrtShell(); + const SwFrmFmt* pFmt = pSh->GetFlyFrmFmt(); + if( pFmt && pFmt->GetChain().GetNext() ) + aAutoHeightCB.Enable( sal_False ); + } + } + else + aAutoHeightCB.Hide(); + + // Umlauf-Abstand fuer zeichengebundene Rahmen organisieren + const SvxULSpaceItem &rUL = (const SvxULSpaceItem &)rSet.Get(RES_UL_SPACE); + nUpperBorder = rUL.GetUpper(); + nLowerBorder = rUL.GetLower(); + + if(SFX_ITEM_SET == rSet.GetItemState(FN_KEEP_ASPECT_RATIO)) + { + aFixedRatioCB.Check(((const SfxBoolItem&)rSet.Get(FN_KEEP_ASPECT_RATIO)).GetValue()); + aFixedRatioCB.SaveValue(); + } + + // Spalten + SwFmtCol aCol( (const SwFmtCol&)rSet.Get(RES_COL) ); + ::FitToActualSize( aCol, (sal_uInt16)rSize.GetWidth() ); + + RndStdIds eAnchorId = (RndStdIds)GetAnchor(); + + if ( bNew && !bFormat ) + InitPos(eAnchorId, USHRT_MAX, 0, USHRT_MAX, USHRT_MAX, LONG_MAX, LONG_MAX); + else + { + const SwFmtHoriOrient& rHori = (const SwFmtHoriOrient&)rSet.Get(RES_HORI_ORIENT); + const SwFmtVertOrient& rVert = (const SwFmtVertOrient&)rSet.Get(RES_VERT_ORIENT); + nOldH = rHori.GetHoriOrient(); + nOldHRel = rHori.GetRelationOrient(); + nOldV = rVert.GetVertOrient(), + nOldVRel = rVert.GetRelationOrient(); + + if (eAnchorId == FLY_AT_PAGE) + { + if (nOldHRel == text::RelOrientation::FRAME) + nOldHRel = text::RelOrientation::PAGE_FRAME; + else if (nOldHRel == text::RelOrientation::PRINT_AREA) + nOldHRel = text::RelOrientation::PAGE_PRINT_AREA; + if (nOldVRel == text::RelOrientation::FRAME) + nOldVRel = text::RelOrientation::PAGE_FRAME; + else if (nOldVRel == text::RelOrientation::PRINT_AREA) + nOldVRel = text::RelOrientation::PAGE_PRINT_AREA; + } + + aMirrorPagesCB.Check(rHori.IsPosToggle()); + aMirrorPagesCB.SaveValue(); + + InitPos(eAnchorId, + nOldH, + nOldHRel, + nOldV, + nOldVRel, + rHori.GetPos(), + rVert.GetPos()); + } + + // Transparent fuers Bsp + // Umlauf fuers Bsp + const SwFmtSurround& rSurround = (const SwFmtSurround&)rSet.Get(RES_SURROUND); + aExampleWN.SetWrap ( static_cast< sal_uInt16 >(rSurround.GetSurround()) ); + + if ( rSurround.GetSurround() == SURROUND_THROUGHT ) + { + const SvxOpaqueItem& rOpaque = (const SvxOpaqueItem&)rSet.Get(RES_OPAQUE); + aExampleWN.SetTransparent(!rOpaque.GetValue()); + } + + // ggf auf Prozent umschalten + RangeModifyHdl(&aWidthED); // Referenzwerte setzen (fuer 100%) + + if (rSize.GetWidthPercent() == 0xff || rSize.GetHeightPercent() == 0xff) + aFixedRatioCB.Check(sal_True); + if (rSize.GetWidthPercent() && rSize.GetWidthPercent() != 0xff && + !aRelWidthCB.IsChecked()) + { + aRelWidthCB.Check(sal_True); + RelSizeClickHdl(&aRelWidthCB); + aWidthED.SetPrcntValue(rSize.GetWidthPercent(), FUNIT_CUSTOM); + } + if (rSize.GetHeightPercent() && rSize.GetHeightPercent() != 0xff && + !aRelHeightCB.IsChecked()) + { + aRelHeightCB.Check(sal_True); + RelSizeClickHdl(&aRelHeightCB); + aHeightED.SetPrcntValue(rSize.GetHeightPercent(), FUNIT_CUSTOM); + } + aRelWidthCB.SaveValue(); + aRelHeightCB.SaveValue(); +} + +sal_uInt16* SwFrmPage::GetRanges() +{ + return aPageRg; +} +/* -----------------------------03.11.00 10:52-------------------------------- + + ---------------------------------------------------------------------------*/ +void SwFrmPage::SetFormatUsed(sal_Bool bFmt) +{ + bFormat = bFmt; + if(bFormat) + { + aAnchorAtPageRB.Hide(); + aAnchorAtParaRB.Hide(); + aAnchorAtCharRB.Hide(); + aAnchorAsCharRB.Hide(); + aAnchorAtFrameRB.Hide(); + aTypeFL.Hide(); + aTypeSepFL.Hide(); + +// Point aSizePos = aSizeFL.GetPosPixel(); +// Size aSizeSize = aSizeFL.GetSizePixel(); +// aSizeSize.Width() = aTypeFL.GetPosPixel().X() + +// aTypeFL.GetSizePixel().Width() - aSizePos.X(); +// aSizeFL.SetSizePixel(aSizeSize); + } +} + + +void SwFrmPage::EnableVerticalPositioning( bool bEnable ) +{ + m_bAllowVertPositioning = bEnable; + aVerticalFT.Enable( bEnable ); + aVerticalDLB.Enable( bEnable ); + aAtVertPosFT.Enable( bEnable ); + aAtVertPosED.Enable( bEnable ); + aVertRelationFT.Enable( bEnable ); + aVertRelationLB.Enable( bEnable ); +} + + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +SwGrfExtPage::SwGrfExtPage(Window *pParent, const SfxItemSet &rSet) : + SfxTabPage( pParent, SW_RES(TP_GRF_EXT), rSet ), + aMirrorFL (this, SW_RES( FL_MIRROR )), + aMirrorVertBox (this, SW_RES( CB_VERT )), + aMirrorHorzBox (this, SW_RES( CB_HOR )), + aAllPagesRB (this, SW_RES( RB_MIRROR_ALL_PAGES )), + aLeftPagesRB (this, SW_RES( RB_MIRROR_LEFT_PAGES )), + aRightPagesRB (this, SW_RES( RB_MIRROR_RIGHT_PAGES )), + aBmpWin (this, WN_BMP, Graphic(), BitmapEx(SW_RES(BMP_EXAMPLE)), BitmapEx(SW_RES(BMP_EXAMPLE_HC)) ), + aConnectFL (this, SW_RES( FL_CONNECT )), + aConnectFT (this, SW_RES( FT_CONNECT )), + aConnectED (this, SW_RES( ED_CONNECT )), + aBrowseBT (this, SW_RES( PB_BROWSE )), + pGrfDlg ( 0 ) +{ + FreeResource(); + + aBrowseBT.SetAccessibleRelationMemberOf(&aConnectFL); + + SetExchangeSupport(); + aMirrorHorzBox.SetClickHdl( LINK(this, SwGrfExtPage, MirrorHdl)); + aMirrorVertBox.SetClickHdl( LINK(this, SwGrfExtPage, MirrorHdl)); + aBrowseBT.SetClickHdl ( LINK(this, SwGrfExtPage, BrowseHdl)); +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +SwGrfExtPage::~SwGrfExtPage() +{ + delete pGrfDlg; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +SfxTabPage* SwGrfExtPage::Create( Window *pParent, const SfxItemSet &rSet ) +{ + return new SwGrfExtPage( pParent, rSet ); +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +void SwGrfExtPage::Reset(const SfxItemSet &rSet) +{ + const SfxPoolItem* pItem; + sal_uInt16 nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current()); + bHtmlMode = nHtmlMode & HTMLMODE_ON ? sal_True : sal_False; + + if( SFX_ITEM_SET == rSet.GetItemState( FN_PARAM_GRF_CONNECT, sal_True, &pItem) + && ((const SfxBoolItem *)pItem)->GetValue() ) + { + aBrowseBT.Enable(); + aConnectED.SetReadOnly(sal_False); + } + + ActivatePage(rSet); +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +void SwGrfExtPage::ActivatePage(const SfxItemSet& rSet) +{ + const SvxProtectItem& rProt = (const SvxProtectItem& )rSet.Get(RES_PROTECT); + sal_Bool bProtCntnt = rProt.IsCntntProtected(); + + const SfxPoolItem* pItem = 0; + sal_Bool bEnable = sal_False; + sal_Bool bEnableMirrorRB = sal_False; + + SfxItemState eState = rSet.GetItemState(RES_GRFATR_MIRRORGRF, sal_True, &pItem); + if( SFX_ITEM_UNKNOWN != eState && !bProtCntnt && !bHtmlMode ) + { + if( SFX_ITEM_SET != eState ) + pItem = &rSet.Get( RES_GRFATR_MIRRORGRF ); + + bEnable = sal_True; + + MirrorGraph eMirror = static_cast< MirrorGraph >(((const SwMirrorGrf* )pItem)->GetValue()); + switch( eMirror ) + { + case RES_MIRROR_GRAPH_DONT: break; + case RES_MIRROR_GRAPH_VERT: aMirrorHorzBox.Check(sal_True); break; + case RES_MIRROR_GRAPH_HOR: aMirrorVertBox.Check(sal_True); break; + case RES_MIRROR_GRAPH_BOTH: aMirrorHorzBox.Check(sal_True); + aMirrorVertBox.Check(sal_True); + break; + default: + ; + } + + sal_uInt16 nPos = ((const SwMirrorGrf* )pItem)->IsGrfToggle() ? 1 : 0; + nPos += (eMirror == RES_MIRROR_GRAPH_VERT || eMirror == RES_MIRROR_GRAPH_BOTH) + ? 2 : 0; + + bEnableMirrorRB = nPos != 0; + + switch (nPos) + { + case 1: // Auf linken bzw geraden Seiten spiegeln + aLeftPagesRB.Check(); + aMirrorHorzBox.Check(sal_True); + break; + case 2: // Auf allen Seiten spiegeln + aAllPagesRB.Check(); + break; + case 3: // Auf rechten bzw ungeraden Seiten spiegeln + aRightPagesRB.Check(); + break; + default: + aAllPagesRB.Check(); + break; + } + } + + if( SFX_ITEM_SET == rSet.GetItemState( SID_ATTR_GRAF_GRAPHIC, sal_False, &pItem ) ) + { + const SvxBrushItem& rBrush = *(SvxBrushItem*)pItem; + if( rBrush.GetGraphicLink() ) + { + aGrfName = aNewGrfName = *rBrush.GetGraphicLink(); + aConnectED.SetText( aNewGrfName ); + } + const Graphic* pGrf = rBrush.GetGraphic(); + if( pGrf ) + aBmpWin.SetGraphic( *pGrf ); + } + + aAllPagesRB .Enable(bEnableMirrorRB); + aLeftPagesRB.Enable(bEnableMirrorRB); + aRightPagesRB.Enable(bEnableMirrorRB); + aMirrorHorzBox.Enable(bEnable); + aMirrorVertBox.Enable(bEnable); + aMirrorFL.Enable(bEnable); + + aAllPagesRB .SaveValue(); + aLeftPagesRB.SaveValue(); + aRightPagesRB.SaveValue(); + aMirrorHorzBox.SaveValue(); + aMirrorVertBox.SaveValue(); + + aBmpWin.MirrorHorz( aMirrorVertBox.IsChecked() ); + aBmpWin.MirrorVert( aMirrorHorzBox.IsChecked() ); + aBmpWin.Invalidate(); +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +sal_Bool SwGrfExtPage::FillItemSet( SfxItemSet &rSet ) +{ + sal_Bool bModified = sal_False; + if ( aMirrorHorzBox.GetSavedValue() != aMirrorHorzBox.IsChecked() || + aMirrorVertBox.GetSavedValue() != aMirrorVertBox.IsChecked() || + aAllPagesRB .GetSavedValue() != aAllPagesRB .IsChecked() || + aLeftPagesRB.GetSavedValue() != aLeftPagesRB.IsChecked() || + aRightPagesRB.GetSavedValue() != aRightPagesRB.IsChecked()) + { + bModified = sal_True; + + sal_Bool bHori = sal_False; + + if (aMirrorHorzBox.IsChecked() && + !aLeftPagesRB.IsChecked()) + bHori = sal_True; + + MirrorGraph eMirror; + eMirror = aMirrorVertBox.IsChecked() && bHori ? + RES_MIRROR_GRAPH_BOTH : bHori ? + RES_MIRROR_GRAPH_VERT : aMirrorVertBox.IsChecked() ? + RES_MIRROR_GRAPH_HOR : RES_MIRROR_GRAPH_DONT; + + sal_Bool bMirror = !aAllPagesRB.IsChecked(); + SwMirrorGrf aMirror( eMirror ); + aMirror.SetGrfToggle(bMirror ); + rSet.Put( aMirror ); + } + + if( aGrfName != aNewGrfName || aConnectED.IsModified() ) + { + bModified = sal_True; + aGrfName = aConnectED.GetText(); + rSet.Put( SvxBrushItem( aGrfName, aFilterName, GPOS_LT, + SID_ATTR_GRAF_GRAPHIC )); + } + return bModified; +} +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +int SwGrfExtPage::DeactivatePage(SfxItemSet *_pSet) +{ + if( _pSet ) + FillItemSet( *_pSet ); + return sal_True; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +IMPL_LINK( SwGrfExtPage, BrowseHdl, Button *, EMPTYARG ) +{ + if(!pGrfDlg) + { + pGrfDlg = new FileDialogHelper( SFXWB_GRAPHIC ); + pGrfDlg->SetTitle(SW_RESSTR(STR_EDIT_GRF )); + } + pGrfDlg->SetDisplayDirectory( aConnectED.GetText() ); + uno::Reference < ui::dialogs::XFilePicker > xFP = pGrfDlg->GetFilePicker(); + uno::Reference < ui::dialogs::XFilePickerControlAccess > xCtrlAcc(xFP, uno::UNO_QUERY); + sal_Bool bTrue = sal_True; + uno::Any aVal(&bTrue, ::getBooleanCppuType()); + xCtrlAcc->setValue( ui::dialogs::ExtendedFilePickerElementIds::CHECKBOX_LINK, 0, aVal); + + if ( pGrfDlg->Execute() == ERRCODE_NONE ) + { // ausgewaehlten Filter merken + aFilterName = pGrfDlg->GetCurrentFilter(); + aNewGrfName = INetURLObject::decode( pGrfDlg->GetPath(), + INET_HEX_ESCAPE, + INetURLObject::DECODE_UNAMBIGUOUS, + RTL_TEXTENCODING_UTF8 ); + aConnectED.SetModifyFlag(); + aConnectED.SetText( aNewGrfName ); + //Spiegeln zuruecksetzen, da u. U. eine Bitmap + //gegen eine andere Art von Grafik ausgetauscht worden ist, + //die nicht gespiegelt werden kann. + aMirrorVertBox.Check(sal_False); + aMirrorHorzBox.Check(sal_False); + aAllPagesRB .Enable(sal_False); + aLeftPagesRB.Enable(sal_False); + aRightPagesRB.Enable(sal_False); + aBmpWin.MirrorHorz(sal_False); + aBmpWin.MirrorVert(sal_False); + + Graphic aGraphic; + GraphicFilter::LoadGraphic( pGrfDlg->GetPath(), aEmptyStr, aGraphic ); + aBmpWin.SetGraphic(aGraphic); + + sal_Bool bEnable = GRAPHIC_BITMAP == aGraphic.GetType() || + GRAPHIC_GDIMETAFILE == aGraphic.GetType(); + aMirrorVertBox.Enable(bEnable); + aMirrorHorzBox.Enable(bEnable); + aAllPagesRB .Enable(bEnable); + aLeftPagesRB.Enable(bEnable); + aRightPagesRB.Enable(bEnable); + } + return 0; +} +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +IMPL_LINK( SwGrfExtPage, MirrorHdl, CheckBox *, EMPTYARG ) +{ + sal_Bool bEnable = aMirrorHorzBox.IsChecked(); + + aBmpWin.MirrorHorz( aMirrorVertBox.IsChecked() ); + aBmpWin.MirrorVert( bEnable ); + + aAllPagesRB .Enable(bEnable); + aLeftPagesRB.Enable(bEnable); + aRightPagesRB.Enable(bEnable); + + if (!aAllPagesRB.IsChecked() && !aLeftPagesRB.IsChecked() && !aRightPagesRB.IsChecked()) + aAllPagesRB.Check(); + + return 0; +} + +/*-------------------------------------------------------------------- + Beschreibung: BeispielWindow + --------------------------------------------------------------------*/ + +BmpWindow::BmpWindow( Window* pPar, sal_uInt16 nId, + const Graphic& rGraphic, const BitmapEx& rBmp, const BitmapEx& rBmpHC ) : + Window(pPar, SW_RES(nId)), + aGraphic(rGraphic), + aBmp(rBmp), + aBmpHC(rBmpHC), + bHorz(sal_False), + bVert(sal_False), + bGraphic(sal_False), + bLeftAlign(sal_False) +{ + SetBackground(); +} + +void BmpWindow::Paint( const Rectangle& ) +{ + Point aPntPos; + Size aPntSz( GetSizePixel() ); + Size aGrfSize; + if(bGraphic) + aGrfSize = ::GetGraphicSizeTwip(aGraphic, this); + //it should show the default bitmap also if no graphic can be found + if(!aGrfSize.Width() && !aGrfSize.Height()) + aGrfSize = PixelToLogic(aBmp.GetSizePixel()); + + long nRelGrf = aGrfSize.Width() * 100L / aGrfSize.Height(); + long nRelWin = aPntSz.Width() * 100L / aPntSz.Height(); + if(nRelGrf < nRelWin) + { + const long nWidth = aPntSz.Width(); + aPntSz.Width() = aPntSz.Height() * nRelGrf /100; + if(!bLeftAlign) + aPntPos.X() += nWidth - aPntSz.Width() ; + } + + if ( bHorz ) + { + aPntPos.Y() += aPntSz.Height(); + aPntPos.Y() --; + aPntSz.Height() *= -1; + } + if ( bVert ) + { + aPntPos.X() += aPntSz.Width(); + aPntPos.X()--; + aPntSz.Width() *= -1; + } + + if ( bGraphic ) + aGraphic.Draw( this, aPntPos, aPntSz ); + else + { + bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode(); + DrawBitmapEx( aPntPos, aPntSz, bHC ? aBmpHC : aBmp ); + } +} + +BmpWindow::~BmpWindow() +{ +} + +void BmpWindow::SetGraphic(const Graphic& rGrf) +{ + aGraphic = rGrf; + Size aGrfSize = ::GetGraphicSizeTwip(aGraphic, this); + bGraphic = aGrfSize.Width() && aGrfSize.Height(); + Invalidate(); +} + +/*************************************************************************** + Beschreibung: URL und ImageMap an Rahmen einstellen +***************************************************************************/ + + +SwFrmURLPage::SwFrmURLPage( Window *pParent, const SfxItemSet &rSet ) : + SfxTabPage(pParent, SW_RES(TP_FRM_URL), rSet), + aHyperLinkFL (this, SW_RES( FL_HYPERLINK )), + aURLFT (this, SW_RES( FT_URL )), + aURLED (this, SW_RES( ED_URL )), + aSearchPB (this, SW_RES( PB_SEARCH )), + aNameFT (this, SW_RES( FT_NAME )), + aNameED (this, SW_RES( ED_NAME )), + aFrameFT (this, SW_RES( FT_FRAME )), + aFrameCB (this, SW_RES( CB_FRAME )), + + aImageFL (this, SW_RES( FL_IMAGE )), + aServerCB (this, SW_RES( CB_SERVER )), + aClientCB (this, SW_RES( CB_CLIENT )) +{ + FreeResource(); + aSearchPB.SetClickHdl(LINK(this, SwFrmURLPage, InsertFileHdl)); +} + +/*************************************************************************** + Beschreibung: +***************************************************************************/ + +SwFrmURLPage::~SwFrmURLPage() +{ +} + +/*************************************************************************** + Beschreibung: +***************************************************************************/ + +void SwFrmURLPage::Reset( const SfxItemSet &rSet ) +{ + const SfxPoolItem* pItem; + if ( SFX_ITEM_SET == rSet.GetItemState( SID_DOCFRAME, sal_True, &pItem)) + { + TargetList* pList = new TargetList; + ((const SfxFrameItem*)pItem)->GetFrame()->GetTargetList(*pList); + sal_uInt16 nCount = (sal_uInt16)pList->Count(); + if( nCount ) + { + sal_uInt16 i; + for ( i = 0; i < nCount; i++ ) + { + aFrameCB.InsertEntry(*pList->GetObject(i)); + } + for ( i = nCount; i; i-- ) + { + delete pList->GetObject( i - 1 ); + } + } + delete pList; + } + + if ( SFX_ITEM_SET == rSet.GetItemState( RES_URL, sal_True, &pItem ) ) + { + const SwFmtURL* pFmtURL = (const SwFmtURL*)pItem; + aURLED.SetText( INetURLObject::decode( pFmtURL->GetURL(), + INET_HEX_ESCAPE, + INetURLObject::DECODE_UNAMBIGUOUS, + RTL_TEXTENCODING_UTF8 )); + aNameED.SetText( pFmtURL->GetName()); + + aClientCB.Enable( pFmtURL->GetMap() != 0 ); + aClientCB.Check ( pFmtURL->GetMap() != 0 ); + aServerCB.Check ( pFmtURL->IsServerMap() ); + + aFrameCB.SetText(pFmtURL->GetTargetFrameName()); + aFrameCB.SaveValue(); + } + else + aClientCB.Enable( sal_False ); + + aServerCB.SaveValue(); + aClientCB.SaveValue(); +} + + + +/*************************************************************************** + Beschreibung: +***************************************************************************/ + +sal_Bool SwFrmURLPage::FillItemSet(SfxItemSet &rSet) +{ + sal_Bool bModified = sal_False; + const SwFmtURL* pOldURL = (SwFmtURL*)GetOldItem(rSet, RES_URL); + SwFmtURL* pFmtURL; + if(pOldURL) + pFmtURL = (SwFmtURL*)pOldURL->Clone(); + else + pFmtURL = new SwFmtURL(); + + { + String sText = aURLED.GetText(); + + if( pFmtURL->GetURL() != sText || + pFmtURL->GetName() != aNameED.GetText() || + aServerCB.IsChecked() != pFmtURL->IsServerMap() ) + { + pFmtURL->SetURL( sText, aServerCB.IsChecked() ); + pFmtURL->SetName( aNameED.GetText() ); + bModified = sal_True; + } + } + + if(!aClientCB.IsChecked() && pFmtURL->GetMap() != 0) + { + pFmtURL->SetMap(0); + bModified = sal_True; + } + + if(pFmtURL->GetTargetFrameName() != aFrameCB.GetText()) + { + pFmtURL->SetTargetFrameName(aFrameCB.GetText()); + bModified = sal_True; + } + rSet.Put(*pFmtURL); + delete pFmtURL; + return bModified; +} + +/*************************************************************************** + Beschreibung: +***************************************************************************/ + +SfxTabPage* SwFrmURLPage::Create(Window *pParent, const SfxItemSet &rSet) +{ + return new SwFrmURLPage( pParent, rSet ); +} + +/*************************************************************************** + Beschreibung: +***************************************************************************/ + +IMPL_LINK( SwFrmURLPage, InsertFileHdl, PushButton *, EMPTYARG ) +{ + FileDialogHelper aDlgHelper( ui::dialogs::TemplateDescription::FILEOPEN_SIMPLE, 0 ); + uno::Reference < ui::dialogs::XFilePicker > xFP = aDlgHelper.GetFilePicker(); + + try + { + String sTemp(aURLED.GetText()); + if(sTemp.Len()) + xFP->setDisplayDirectory(sTemp); + } + catch( const uno::Exception& rEx ) + { + (void) rEx; + } + if( aDlgHelper.Execute() == ERRCODE_NONE ) + { + aURLED.SetText( xFP->getFiles().getConstArray()[0] ); + } + + return 0; +} + +/* -----------------------------03.11.00 10:56-------------------------------- + + ---------------------------------------------------------------------------*/ +void lcl_Move(Window& rWin, sal_Int32 nDiff) +{ + Point aPos(rWin.GetPosPixel()); + aPos.Y() -= nDiff; + rWin.SetPosPixel(aPos); +} + +/*-----------------13.11.96 13.15------------------- + +--------------------------------------------------*/ + +SwFrmAddPage::SwFrmAddPage(Window *pParent, const SfxItemSet &rSet ) : + SfxTabPage(pParent, SW_RES(TP_FRM_ADD), rSet), + + aNamesFL (this, SW_RES(FL_NAME)), + aNameFT (this, SW_RES(FT_NAME)), + aNameED (this, SW_RES(ED_NAME)), + aAltNameFT (this, SW_RES(FT_ALT_NAME)), + aAltNameED (this, SW_RES(ED_ALT_NAME)), + aPrevFT (this, SW_RES(FT_PREV)), + aPrevLB (this, SW_RES(LB_PREV)), + aNextFT (this, SW_RES(FT_NEXT)), + aNextLB (this, SW_RES(LB_NEXT)), + + aProtectFL (this, SW_RES(FL_PROTECT)), + aProtectContentCB (this, SW_RES(CB_PROTECT_CONTENT)), + aProtectFrameCB (this, SW_RES(CB_PROTECT_FRAME)), + aProtectSizeCB (this, SW_RES(CB_PROTECT_SIZE)), + aExtFL (this, SW_RES(FL_EXT)), + + aEditInReadonlyCB (this, SW_RES(CB_EDIT_IN_READONLY)), + aPrintFrameCB (this, SW_RES(CB_PRINT_FRAME)), + aTextFlowFT (this, SW_RES(FT_TEXTFLOW)), + aTextFlowLB (this, SW_RES(LB_TEXTFLOW)), + + pWrtSh(0), + + nDlgType(0), + bHtmlMode(sal_False), + bFormat(sal_False), + bNew(sal_False) +{ + FreeResource(); + +} + +/*-----------------13.11.96 13.15------------------- + +--------------------------------------------------*/ + +SwFrmAddPage::~SwFrmAddPage() +{ +} + +/*-----------------13.11.96 13.15------------------- + +--------------------------------------------------*/ + +SfxTabPage* SwFrmAddPage::Create(Window *pParent, const SfxItemSet &rSet) +{ + return new SwFrmAddPage(pParent, rSet); +} + +/*-----------------13.11.96 13.14------------------- + +--------------------------------------------------*/ + +void SwFrmAddPage::Reset(const SfxItemSet &rSet ) +{ + const SfxPoolItem* pItem; + sal_uInt16 nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current()); + bHtmlMode = nHtmlMode & HTMLMODE_ON ? sal_True : sal_False; + if(bHtmlMode) + { + aProtectContentCB .Hide(); + aProtectFrameCB .Hide(); + aProtectSizeCB .Hide(); + aEditInReadonlyCB .Hide(); + aPrintFrameCB .Hide(); + aExtFL .Hide(); + aProtectFL.Hide(); + } + if ( DLG_FRM_GRF == nDlgType || DLG_FRM_OLE == nDlgType ) + { + aEditInReadonlyCB.Hide(); + aPrintFrameCB.SetPosPixel(aEditInReadonlyCB.GetPosPixel()); + } + + if(SFX_ITEM_SET == rSet.GetItemState(FN_SET_FRM_ALT_NAME, sal_False, &pItem)) + { + aAltNameED.SetText(((const SfxStringItem*)pItem)->GetValue()); + aAltNameED.SaveValue(); + } + + if(!bFormat) + { + // Grafik einfuegen - Eigenschaften + // bNew ist nicht gesetzt, deswegen ueber Selektion erkennen + String aTmpName1; + if(SFX_ITEM_SET == rSet.GetItemState(FN_SET_FRM_NAME, sal_False, &pItem)) + { + aTmpName1 = ((const SfxStringItem*)pItem)->GetValue(); + } + + DBG_ASSERT(pWrtSh, "keine Shell?"); + if( bNew || !aTmpName1.Len() ) + + switch( nDlgType ) + { + case DLG_FRM_GRF: + aTmpName1 = pWrtSh->GetUniqueGrfName(); + break; + case DLG_FRM_OLE: + aTmpName1 = pWrtSh->GetUniqueOLEName(); + break; + default: + aTmpName1 = pWrtSh->GetUniqueFrameName(); + break; + } + + aNameED.SetText( aTmpName1 ); + aNameED.SaveValue(); + } + else + { + aNameED.Enable( sal_False ); + aAltNameED.Enable(sal_False); + aNameFT.Enable( sal_False ); + aAltNameFT.Enable(sal_False); + aNamesFL.Enable(sal_False); + } + if(nDlgType == DLG_FRM_STD && aAltNameFT.IsVisible()) + { + aAltNameFT.Hide(); + aAltNameED.Hide(); + //move all controls one step up + Window* aWindows[] = + { + &aPrevFT, + &aPrevLB, + &aNextFT, + &aNextLB, + &aNamesFL, + &aProtectContentCB, + &aProtectFrameCB, + &aProtectSizeCB, + &aProtectFL, + &aEditInReadonlyCB, + &aPrintFrameCB, + &aTextFlowFT, + &aTextFlowLB, + &aExtFL, + 0 + }; + sal_Int32 nOffset = aAltNameED.GetPosPixel().Y() - aNameED.GetPosPixel().Y(); + sal_Int32 nIdx = 0; + while(aWindows[nIdx]) + { + lcl_Move(*aWindows[nIdx++], nOffset); + } + } + else + { + aNameED.SetModifyHdl(LINK(this, SwFrmAddPage, EditModifyHdl)); + } + + if (!bNew) + { + SwFrmFmt* pFmt = pWrtSh->GetFlyFrmFmt(); + + if (pFmt) + { + const SwFmtChain &rChain = pFmt->GetChain(); + const SwFlyFrmFmt* pFlyFmt; + String sNextChain, sPrevChain; + if ((pFlyFmt = rChain.GetPrev()) != 0) + { + sPrevChain = pFlyFmt->GetName(); + } + + if ((pFlyFmt = rChain.GetNext()) != 0) + { + sNextChain = pFlyFmt->GetName(); + } + //determine chainable frames + ::std::vector< String > aPrevPageFrames; + ::std::vector< String > aThisPageFrames; + ::std::vector< String > aNextPageFrames; + ::std::vector< String > aRemainFrames; + pWrtSh->GetConnectableFrmFmts(*pFmt, sNextChain, sal_False, + aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames ); + lcl_InsertVectors(aPrevLB, aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames); + if(sPrevChain.Len()) + { + if(LISTBOX_ENTRY_NOTFOUND == aPrevLB.GetEntryPos(sPrevChain)) + aPrevLB.InsertEntry(sPrevChain, 1); + aPrevLB.SelectEntry(sPrevChain); + } + else + aPrevLB.SelectEntryPos(0); + aPrevPageFrames.erase(aPrevPageFrames.begin(), aPrevPageFrames.end()); + aNextPageFrames.erase(aNextPageFrames.begin(), aNextPageFrames.end()); + aThisPageFrames.erase(aThisPageFrames.begin(), aThisPageFrames.end()); + aRemainFrames.erase(aRemainFrames.begin(), aRemainFrames.end()); + + + pWrtSh->GetConnectableFrmFmts(*pFmt, sPrevChain, sal_True, + aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames ); + lcl_InsertVectors(aNextLB, aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames); + if(sNextChain.Len()) + { + if(LISTBOX_ENTRY_NOTFOUND == aNextLB.GetEntryPos(sNextChain)) + aNextLB.InsertEntry(sNextChain, 1); + aNextLB.SelectEntry(sNextChain); + } + else + aNextLB.SelectEntryPos(0); + Link aLink(LINK(this, SwFrmAddPage, ChainModifyHdl)); + aPrevLB.SetSelectHdl(aLink); + aNextLB.SetSelectHdl(aLink); + } + } + // Pos Protected + const SvxProtectItem& rProt = (const SvxProtectItem& )rSet.Get(RES_PROTECT); + aProtectFrameCB.Check(rProt.IsPosProtected()); + aProtectContentCB.Check(rProt.IsCntntProtected()); + aProtectSizeCB.Check(rProt.IsSizeProtected()); + + const SwFmtEditInReadonly& rEdit = (const SwFmtEditInReadonly& )rSet.Get(RES_EDIT_IN_READONLY); + aEditInReadonlyCB.Check(rEdit.GetValue()); aEditInReadonlyCB.SaveValue(); + + // drucken + const SvxPrintItem& rPrt = (const SvxPrintItem&)rSet.Get(RES_PRINT); + aPrintFrameCB.Check(rPrt.GetValue()); aPrintFrameCB.SaveValue(); + + // textflow + SfxItemState eState; + if( (!bHtmlMode || (0 != (nHtmlMode&HTMLMODE_SOME_STYLES))) + && DLG_FRM_GRF != nDlgType && DLG_FRM_OLE != nDlgType && + SFX_ITEM_UNKNOWN != ( eState = rSet.GetItemState( + RES_FRAMEDIR, sal_True )) ) + { + aTextFlowFT.Show(); + aTextFlowLB.Show(); + + //vertical text flow is not possible in HTML + if(bHtmlMode) + { + sal_uLong nData = FRMDIR_VERT_TOP_RIGHT; + aTextFlowLB.RemoveEntry(aTextFlowLB.GetEntryPos((void*)nData)); + } + sal_uInt16 nPos, nVal = ((SvxFrameDirectionItem&)rSet.Get(RES_FRAMEDIR)).GetValue(); + for( nPos = aTextFlowLB.GetEntryCount(); nPos; ) + if( (sal_uInt16)(long)aTextFlowLB.GetEntryData( --nPos ) == nVal ) + break; + aTextFlowLB.SelectEntryPos( nPos ); + aTextFlowLB.SaveValue(); + } + else + { + aTextFlowFT.Hide(); + aTextFlowLB.Hide(); + } +} + +/*-----------------13.11.96 13.20------------------- + +--------------------------------------------------*/ + +sal_Bool SwFrmAddPage::FillItemSet(SfxItemSet &rSet) +{ + sal_Bool bRet = sal_False; + if (aNameED.GetText() != aNameED.GetSavedValue()) + bRet |= 0 != rSet.Put(SfxStringItem(FN_SET_FRM_NAME, aNameED.GetText())); + if (aAltNameED.GetText() != aAltNameED.GetSavedValue()) + bRet |= 0 != rSet.Put(SfxStringItem(FN_SET_FRM_ALT_NAME, aAltNameED.GetText())); + + const SfxPoolItem* pOldItem; + SvxProtectItem aProt ( (const SvxProtectItem& )GetItemSet().Get(RES_PROTECT) ); + aProt.SetCntntProtect( aProtectContentCB.IsChecked() ); + aProt.SetSizeProtect ( aProtectSizeCB.IsChecked() ); + aProt.SetPosProtect ( aProtectFrameCB.IsChecked() ); + if ( 0 == (pOldItem = GetOldItem(rSet, FN_SET_PROTECT)) || + aProt != *pOldItem ) + bRet |= 0 != rSet.Put( aProt); + + sal_Bool bChecked; + if ( (bChecked = aEditInReadonlyCB.IsChecked()) != aEditInReadonlyCB.GetSavedValue() ) + bRet |= 0 != rSet.Put( SwFmtEditInReadonly( RES_EDIT_IN_READONLY, bChecked)); + + if ( (bChecked = aPrintFrameCB.IsChecked()) != aPrintFrameCB.GetSavedValue() ) + bRet |= 0 != rSet.Put( SvxPrintItem( RES_PRINT, bChecked)); + + // textflow + if( aTextFlowLB.IsVisible() ) + { + sal_uInt16 nPos = aTextFlowLB.GetSelectEntryPos(); + if( nPos != aTextFlowLB.GetSavedValue() ) + { + nPos = (sal_uInt16)(long)aTextFlowLB.GetEntryData( nPos ); + bRet |= 0 != rSet.Put( SvxFrameDirectionItem( + (SvxFrameDirection)nPos, RES_FRAMEDIR )); + } + } + if(pWrtSh) + { + const SwFrmFmt* pFmt = pWrtSh->GetFlyFrmFmt(); + if (pFmt) + { + String sCurrentPrevChain, sCurrentNextChain; + if(aPrevLB.GetSelectEntryPos()) + sCurrentPrevChain = aPrevLB.GetSelectEntry(); + if(aNextLB.GetSelectEntryPos()) + sCurrentNextChain = aNextLB.GetSelectEntry(); + const SwFmtChain &rChain = pFmt->GetChain(); + const SwFlyFrmFmt* pFlyFmt; + String sNextChain, sPrevChain; + if ((pFlyFmt = rChain.GetPrev()) != 0) + sPrevChain = pFlyFmt->GetName(); + + if ((pFlyFmt = rChain.GetNext()) != 0) + sNextChain = pFlyFmt->GetName(); + if(sPrevChain != sCurrentPrevChain) + bRet |= 0 != rSet.Put(SfxStringItem(FN_PARAM_CHAIN_PREVIOUS, sCurrentPrevChain)); + if(sNextChain != sCurrentNextChain) + bRet |= 0 != rSet.Put(SfxStringItem(FN_PARAM_CHAIN_NEXT, sCurrentNextChain)); + } + } + return bRet; +} + +/*-----------------13.11.96 15.05------------------- + +--------------------------------------------------*/ + +sal_uInt16* SwFrmAddPage::GetRanges() +{ + return aAddPgRg; +} + +/*-----------------13.11.96 16.12------------------- + +--------------------------------------------------*/ + +IMPL_LINK(SwFrmAddPage, EditModifyHdl, Edit*, EMPTYARG) +{ + sal_Bool bEnable = 0 != aNameED.GetText().Len(); + aAltNameED.Enable(bEnable); + aAltNameFT.Enable(bEnable); + + return 0; +} +//----------------------------------------------------------------------------- +void SwFrmAddPage::SetFormatUsed(sal_Bool bFmt) +{ + bFormat = bFmt; + if(bFormat) + { + aNameFT.Show(sal_False); + aNameED.Show(sal_False); + aAltNameFT.Show(sal_False); + aAltNameED.Show(sal_False); + aPrevFT.Show(sal_False); + aPrevLB.Show(sal_False); + aNextFT.Show(sal_False); + aNextLB.Show(sal_False); + aNamesFL.Show(sal_False); + + sal_Int32 nDiff = aExtFL.GetPosPixel().Y() - aNamesFL.GetPosPixel().Y(); + Window* aWindows[] = + { + &aProtectContentCB, + &aProtectFrameCB, + &aProtectSizeCB, + &aProtectFL, + &aEditInReadonlyCB, + &aPrintFrameCB, + &aExtFL, + &aTextFlowFT, + &aTextFlowLB, + 0 + }; + sal_Int32 nIdx = 0; + while(aWindows[nIdx]) + lcl_Move(*aWindows[nIdx++], nDiff); + } +} +/* -----------------------------08.08.2002 16:24------------------------------ + + ---------------------------------------------------------------------------*/ +IMPL_LINK(SwFrmAddPage, ChainModifyHdl, ListBox*, pBox) +{ + String sCurrentPrevChain, sCurrentNextChain; + if(aPrevLB.GetSelectEntryPos()) + sCurrentPrevChain = aPrevLB.GetSelectEntry(); + if(aNextLB.GetSelectEntryPos()) + sCurrentNextChain = aNextLB.GetSelectEntry(); + SwFrmFmt* pFmt = pWrtSh->GetFlyFrmFmt(); + if (pFmt) + { + sal_Bool bNextBox = &aNextLB == pBox; + ListBox& rChangeLB = bNextBox ? aPrevLB : aNextLB; + for(sal_uInt16 nEntry = rChangeLB.GetEntryCount(); nEntry > 1; nEntry--) + rChangeLB.RemoveEntry(nEntry - 1); + //determine chainable frames + ::std::vector< String > aPrevPageFrames; + ::std::vector< String > aThisPageFrames; + ::std::vector< String > aNextPageFrames; + ::std::vector< String > aRemainFrames; + pWrtSh->GetConnectableFrmFmts(*pFmt, bNextBox ? sCurrentNextChain : sCurrentPrevChain, !bNextBox, + aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames ); + lcl_InsertVectors(rChangeLB, + aPrevPageFrames, aThisPageFrames, aNextPageFrames, aRemainFrames); + String sToSelect = bNextBox ? sCurrentPrevChain : sCurrentNextChain; + if(rChangeLB.GetEntryPos(sToSelect) != LISTBOX_ENTRY_NOTFOUND) + rChangeLB.SelectEntry(sToSelect); + else + rChangeLB.SelectEntryPos(0); + + } + return 0; +} diff --git a/sw/source/ui/frmdlg/frmpage.hrc b/sw/source/ui/frmdlg/frmpage.hrc new file mode 100644 index 000000000000..044d2fdd4e05 --- /dev/null +++ b/sw/source/ui/frmdlg/frmpage.hrc @@ -0,0 +1,146 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include <svtools/controldims.hrc> + +#define RB_ANCHOR_PAGE 1 +#define RB_ANCHOR_PARA 2 +#define RB_ANCHOR_AT_CHAR 3 +#define RB_ANCHOR_AS_CHAR 4 +#define RB_ANCHOR_FRAME 5 +#define WN_BSP 21 +#define FT_BSP 22 + + +// SwFrmPage +#define FL_TYPE 26 +#define FT_WIDTH 27 +#define ED_WIDTH 28 +#define FT_HEIGHT 29 +#define ED_HEIGHT 30 +#define CB_AUTOHEIGHT 31 +#define FL_SIZE 32 +#define FT_HORIZONTAL 33 +#define DLB_HORIZONTAL 34 +#define FT_AT_HORZ_POS 35 +#define ED_AT_HORZ_POS 36 +#define FT_HORI_RELATION 1 +#define LB_HORI_RELATION 2 +#define CB_MIRROR 37 +#define FT_VERTICAL 38 +#define DLB_VERTICAL 39 +#define FT_AT_VERT_POS 40 +#define ED_AT_VERT_POS 41 +#define FT_VERT_RELATION 3 +#define LB_VERT_RELATION 4 +#define FL_POSITION 43 +#define BT_REALSIZE 44 +#define BT_MANUAL 45 +#define CB_AUTOWIDTH 46 +#define FT_WIDTH_AUTO 47 +#define FT_HEIGHT_AUTO 48 + +// metrics +#define SWFRMPG_COL_0 RSC_SP_TBPG_INNERBORDER_LEFT +#define SWFRMPG_COL_1 (SWFRMPG_COL_0+RSC_SP_FLGR_INNERBORDER_LEFT) +#define SWFRMPG_COL_2 (SWFRMPG_COL_1+RSC_SP_FLGR_INNERBORDER_LEFT) +#define SWFRMPG_COL_3 76 +#define SWFRMPG_COL_4 109 + +#define SWFRMPG_ROW_CONDENSE 1 +#define SWFRMPG_ROW_0 RSC_SP_TBPG_INNERBORDER_TOP +#define SWFRMPG_ROW_1 (SWFRMPG_ROW_0+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_INNERBORDER_TOP-SWFRMPG_ROW_CONDENSE) +#define SWFRMPG_ROW_2 (SWFRMPG_ROW_1+((RSC_CD_TEXTBOX_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2)) +#define SWFRMPG_ROW_3 (SWFRMPG_ROW_1+RSC_CD_TEXTBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y-SWFRMPG_ROW_CONDENSE) +#define SWFRMPG_ROW_4 (SWFRMPG_ROW_3+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y-SWFRMPG_ROW_CONDENSE) +#define SWFRMPG_ROW_5 (SWFRMPG_ROW_4+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y-SWFRMPG_ROW_CONDENSE) +#define SWFRMPG_ROW_6 (SWFRMPG_ROW_5+((RSC_CD_TEXTBOX_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2)) +#define SWFRMPG_ROW_7 (SWFRMPG_ROW_5+RSC_CD_TEXTBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y-SWFRMPG_ROW_CONDENSE) +#define SWFRMPG_ROW_8 (SWFRMPG_ROW_7+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y-SWFRMPG_ROW_CONDENSE) +#define SWFRMPG_ROW_9 (SWFRMPG_ROW_8+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y) +#define SWFRMPG_ROW_10 (SWFRMPG_ROW_9+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_CTRL_Y-SWFRMPG_ROW_CONDENSE) +#define SWFRMPG_ROW_11 (SWFRMPG_ROW_10+RSC_CD_FIXEDLINE_HEIGHT+RSC_SP_FLGR_INNERBORDER_TOP) +#define SWFRMPG_ROW_12 (SWFRMPG_ROW_11+((RSC_CD_TEXTBOX_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2)) +#define SWFRMPG_ROW_13 (SWFRMPG_ROW_11+RSC_CD_TEXTBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y) +#define SWFRMPG_ROW_14 (SWFRMPG_ROW_13+RSC_CD_CHECKBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y) +#define SWFRMPG_ROW_15 (SWFRMPG_ROW_14+((RSC_CD_TEXTBOX_HEIGHT-RSC_CD_FIXEDTEXT_HEIGHT)/2)) +#define SWFRMPG_ROW_16 (SWFRMPG_ROW_14+RSC_CD_TEXTBOX_HEIGHT+RSC_SP_FLGR_SPACE_Y) + + +#define CB_HOR 46 +#define CB_VERT 47 +//#define LB_MIRROR_PAGES 49 +//#define FT_MIRROR_PAGES 50 +#define FL_MIRROR 51 +#define WN_BMP 52 +#define PB_BROWSE 53 +#define ED_CONNECT 54 +#define FL_CONNECT 55 +#define FT_CONNECT 57 +#define FT_URL 58 +#define ED_URL 59 + +#define BMP_EXAMPLE 62 +#define BMP_EXAMPLE_HC 63 +#define RB_MIRROR_ALL_PAGES 64 +#define RB_MIRROR_LEFT_PAGES 65 +#define RB_MIRROR_RIGHT_PAGES 66 + +#define FL_HYPERLINK 94 +#define FT_FRAME 95 +#define CB_FRAME 96 +#define FL_IMAGE 97 +#define CB_SERVER 98 +#define CB_CLIENT 99 + +#define CB_REL_WIDTH 100 +#define CB_REL_HEIGHT 101 +#define CB_FIXEDRATIO 102 +#define PB_SEARCH 103 + +#define CB_ANCHOR_ONLY 103 + +#define FT_NAME 110 +#define ED_NAME 111 +#define FT_ALT_NAME 112 +#define ED_ALT_NAME 113 +#define FT_PREV 114 +#define LB_PREV 115 +#define FT_NEXT 116 +#define LB_NEXT 117 +#define FL_NAME 118 +#define CB_PROTECT_CONTENT 119 +#define CB_PROTECT_FRAME 120 +#define CB_PROTECT_SIZE 121 +#define FL_PROTECT 122 +#define CB_EDIT_IN_READONLY 123 +#define CB_PRINT_FRAME 124 +#define FL_EXT 125 +#define FL_TYPE_SEP 126 +#define FT_TEXTFLOW 127 +#define LB_TEXTFLOW 128 +#define CB_FOLLOWTEXTFLOW 129 diff --git a/sw/source/ui/frmdlg/frmpage.src b/sw/source/ui/frmdlg/frmpage.src new file mode 100644 index 000000000000..782607000386 --- /dev/null +++ b/sw/source/ui/frmdlg/frmpage.src @@ -0,0 +1,884 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "frmui.hrc" +#include "frmpage.hrc" +#include "globals.hrc" +#include "helpid.h" +#include "svx/dialogs.hrc" + +TabDialog DLG_FRM_STD +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Text [ en-US ] = "Frame" ; + Moveable = TRUE ; + TabControl 1 + { + OutputSize = TRUE ; + PageList = + { + PageItem + { + Identifier = TP_FRM_STD ; + PageResID = TP_FRM_STD ; + Text [ en-US ] = "Type" ; + }; + PageItem + { + Identifier = TP_FRM_ADD ; + PageResID = TP_FRM_ADD ; + Text [ en-US ] = "Options" ; + }; + PageItem + { + Identifier = TP_FRM_WRAP ; + PageResID = TP_FRM_WRAP ; + Text [ en-US ] = "Wrap" ; + }; + PageItem + { + Identifier = TP_FRM_URL ; + PageResID = TP_FRM_URL ; + Text [ en-US ] = "Hyperlink" ; + }; + PageItem + { + Identifier = TP_BORDER ; + PageResID = TP_BORDER ; + Text [ en-US ] = "Borders" ; + }; + PageItem + { + Identifier = TP_BACKGROUND ; + PageResID = TP_BACKGROUND ; + Text [ en-US ] = "Background" ; + }; + PageItem + { + Identifier = TP_COLUMN ; + PageResID = TP_COLUMN ; + Text [ en-US ] = "Columns" ; + }; + PageItem + { + Identifier = TP_MACRO_ASSIGN ; + Text [ en-US ] = "Macro" ; + }; + }; + }; +}; +TabDialog DLG_FRM_GRF +{ + SVLook = TRUE ; + Text [ en-US ] = "Picture" ; + Moveable = TRUE ; + TabControl 1 + { + OutputSize = TRUE ; + PageList = + { + PageItem + { + Identifier = TP_FRM_STD ; + PageResID = TP_FRM_STD ; + Text [ en-US ] = "Type" ; + }; + PageItem + { + Identifier = TP_FRM_ADD ; + PageResID = TP_FRM_ADD ; + Text [ en-US ] = "Options" ; + }; + PageItem + { + Identifier = TP_FRM_WRAP ; + PageResID = TP_FRM_WRAP ; + Text [ en-US ] = "Wrap" ; + }; + PageItem + { + Identifier = TP_FRM_URL ; + PageResID = TP_FRM_URL ; + Text [ en-US ] = "Hyperlink" ; + }; + PageItem + { + Identifier = TP_GRF_EXT ; + PageResID = TP_GRF_EXT ; + Text [ en-US ] = "Picture" ; + }; + PageItem + { + Identifier = RID_SVXPAGE_GRFCROP; + PageResID = RID_SVXPAGE_GRFCROP; + Text [ en-US ] = "Crop" ; + }; + PageItem + { + Identifier = TP_BORDER ; + PageResID = TP_BORDER ; + Text [ en-US ] = "Borders" ; + }; + PageItem + { + Identifier = TP_BACKGROUND ; + PageResID = TP_BACKGROUND ; + Text [ en-US ] = "Background" ; + }; + PageItem + { + Identifier = TP_MACRO_ASSIGN ; + Text [ en-US ] = "Macro" ; + }; + }; + }; +}; +TabDialog DLG_FRM_OLE +{ + OutputSize = TRUE ; + SVLook = TRUE ; + Text [ en-US ] = "Object" ; + Moveable = TRUE ; + TabControl 1 + { + OutputSize = TRUE ; + PageList = + { + PageItem + { + Identifier = TP_FRM_STD ; + PageResID = TP_FRM_STD ; + Text [ en-US ] = "Type" ; + }; + PageItem + { + Identifier = TP_FRM_ADD ; + PageResID = TP_FRM_ADD ; + Text [ en-US ] = "Options" ; + }; + PageItem + { + Identifier = TP_FRM_WRAP ; + PageResID = TP_FRM_WRAP ; + Text [ en-US ] = "Wrap" ; + }; + PageItem + { + Identifier = TP_FRM_URL ; + PageResID = TP_FRM_URL ; + Text [ en-US ] = "Hyperlink" ; + }; + PageItem + { + Identifier = TP_BORDER ; + PageResID = TP_BORDER ; + Text [ en-US ] = "Borders" ; + }; + PageItem + { + Identifier = TP_BACKGROUND ; + PageResID = TP_BACKGROUND ; + Text [ en-US ] = "Background" ; + }; + /* + PageItem { + Identifier = TP_COLUMN ; + PageResID = TP_COLUMN; + Text [ en-US ] = "Columns" ; + }; +*/ + PageItem + { + Identifier = TP_MACRO_ASSIGN ; + Text [ en-US ] = "Macro" ; + }; + }; + }; +}; +TabPage TP_FRM_STD +{ + HelpID = HID_FRM_STD ; + SVLook = TRUE ; + Pos = MAP_APPFONT ( 0 , 0 ) ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE ; + FixedText FT_WIDTH + { + Pos = MAP_APPFONT ( SWFRMPG_COL_1 , SWFRMPG_ROW_2 ) ; + Size = MAP_APPFONT ( (SWFRMPG_COL_3-SWFRMPG_COL_1-1) , RSC_CD_FIXEDTEXT_HEIGHT ) ; + Left = TRUE ; + Text [ en-US ] = "~Width" ; + }; + FixedText FT_WIDTH_AUTO + { + Pos = MAP_APPFONT ( SWFRMPG_COL_1 , SWFRMPG_ROW_2 ) ; + Size = MAP_APPFONT ( (SWFRMPG_COL_3-SWFRMPG_COL_1-1) , RSC_CD_FIXEDTEXT_HEIGHT ) ; + Left = TRUE ; + Text [ en-US ] = "~Width (at least)" ; + }; + MetricField ED_WIDTH + { + HelpID = "sw:MetricField:TP_FRM_STD:ED_WIDTH"; + Border = TRUE ; + Pos = MAP_APPFONT ( SWFRMPG_COL_3 , SWFRMPG_ROW_1 ) ; + Size = MAP_APPFONT ( (SWFRMPG_COL_4-SWFRMPG_COL_3) , RSC_CD_TEXTBOX_HEIGHT ) ; + Text = "12,99" ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 5 ; + Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + First = 5 ; + Last = 9999 ; + SpinSize = 10 ; + }; + CheckBox CB_REL_WIDTH + { + HelpID = "sw:CheckBox:TP_FRM_STD:CB_REL_WIDTH"; + Pos = MAP_APPFONT ( SWFRMPG_COL_2 , SWFRMPG_ROW_3 ) ; + Size = MAP_APPFONT ( (SWFRMPG_COL_4-SWFRMPG_COL_2) , RSC_CD_CHECKBOX_HEIGHT ) ; + TabStop = TRUE ; + Text [ en-US ] = "Relat~ive" ; + }; + CheckBox CB_AUTOWIDTH + { + HelpID = "sw:CheckBox:TP_FRM_STD:CB_AUTOWIDTH"; + Pos = MAP_APPFONT ( SWFRMPG_COL_2 , SWFRMPG_ROW_4 ) ; + Size = MAP_APPFONT ( (SWFRMPG_COL_4-SWFRMPG_COL_2) , RSC_CD_CHECKBOX_HEIGHT ) ; + TabStop = TRUE ; + Text [ en-US ] = "Automatic"; + }; + FixedText FT_HEIGHT + { + Pos = MAP_APPFONT ( SWFRMPG_COL_1 , SWFRMPG_ROW_6 ) ; + Size = MAP_APPFONT ( (SWFRMPG_COL_3-SWFRMPG_COL_1-1) , RSC_CD_FIXEDTEXT_HEIGHT ) ; + Left = TRUE ; + Text [ en-US ] = "H~eight" ; + }; + FixedText FT_HEIGHT_AUTO + { + Pos = MAP_APPFONT ( SWFRMPG_COL_1 , SWFRMPG_ROW_6 ) ; + Size = MAP_APPFONT ( (SWFRMPG_COL_3-SWFRMPG_COL_1-1) , RSC_CD_FIXEDTEXT_HEIGHT ) ; + Left = TRUE ; + Text [ en-US ] = "H~eight (at least)" ; + }; + MetricField ED_HEIGHT + { + HelpID = "sw:MetricField:TP_FRM_STD:ED_HEIGHT"; + Border = TRUE ; + Pos = MAP_APPFONT ( SWFRMPG_COL_3 , SWFRMPG_ROW_5 ) ; + Size = MAP_APPFONT ( (SWFRMPG_COL_4-SWFRMPG_COL_3) , RSC_CD_TEXTBOX_HEIGHT ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = 5 ; + Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + First = 5 ; + Last = 9999 ; + SpinSize = 10 ; + }; + CheckBox CB_REL_HEIGHT + { + HelpID = "sw:CheckBox:TP_FRM_STD:CB_REL_HEIGHT"; + Pos = MAP_APPFONT ( SWFRMPG_COL_2 , SWFRMPG_ROW_7 ) ; + Size = MAP_APPFONT ( (SWFRMPG_COL_4-SWFRMPG_COL_2) , RSC_CD_CHECKBOX_HEIGHT ) ; + TabStop = TRUE ; + Text [ en-US ] = "Re~lative" ; + }; + CheckBox CB_AUTOHEIGHT + { + HelpID = "sw:CheckBox:TP_FRM_STD:CB_AUTOHEIGHT"; + Pos = MAP_APPFONT ( SWFRMPG_COL_2 , SWFRMPG_ROW_8 ) ; + Size = MAP_APPFONT ( (SWFRMPG_COL_4-SWFRMPG_COL_2) , RSC_CD_CHECKBOX_HEIGHT ) ; + TabStop = TRUE ; + Text [ en-US ] = "AutoSize"; + }; + CheckBox CB_FIXEDRATIO + { + HelpID = "sw:CheckBox:TP_FRM_STD:CB_FIXEDRATIO"; + Pos = MAP_APPFONT ( SWFRMPG_COL_1 , SWFRMPG_ROW_9 ) ; + Size = MAP_APPFONT ( (SWFRMPG_COL_4-SWFRMPG_COL_1) , RSC_CD_CHECKBOX_HEIGHT ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Keep ratio" ; + }; + PushButton BT_REALSIZE + { + HelpID = "sw:PushButton:TP_FRM_STD:BT_REALSIZE"; + Pos = MAP_APPFONT ( 35 , 86 ) ; + Size = MAP_APPFONT ( 70 , 14 ) ; + TabStop = TRUE ; + Hide = TRUE ; + Text [ en-US ] = "~Original Size" ; + }; + FixedLine FL_SIZE + { + Pos = MAP_APPFONT ( SWFRMPG_COL_0 , SWFRMPG_ROW_0 ) ; + Size = MAP_APPFONT ( (SWFRMPG_COL_4-SWFRMPG_COL_0) , RSC_CD_FIXEDLINE_HEIGHT ) ; + Text [ en-US ] = "Size" ; + }; + FixedLine FL_TYPE_SEP + { + Pos = MAP_APPFONT ( 111 , 14 ) ; + Size = MAP_APPFONT ( 4 , (SWFRMPG_ROW_9+RSC_CD_CHECKBOX_HEIGHT-SWFRMPG_ROW_1) ) ; + Vert = TRUE; + }; + RadioButton RB_ANCHOR_PAGE + { + HelpID = "sw:RadioButton:TP_FRM_STD:RB_ANCHOR_PAGE"; + Pos = MAP_APPFONT ( 122 , 14 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "To ~page"; + }; + RadioButton RB_ANCHOR_PARA + { + HelpID = "sw:RadioButton:TP_FRM_STD:RB_ANCHOR_PARA"; + Pos = MAP_APPFONT ( 122 , 28 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "To paragrap~h"; + }; + RadioButton RB_ANCHOR_AT_CHAR + { + HelpID = "sw:RadioButton:TP_FRM_STD:RB_ANCHOR_AT_CHAR"; + Pos = MAP_APPFONT ( 122 , 42 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "To cha~racter"; + }; + RadioButton RB_ANCHOR_AS_CHAR + { + HelpID = "sw:RadioButton:TP_FRM_STD:RB_ANCHOR_AS_CHAR"; + Pos = MAP_APPFONT ( 122 , 56 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "~As character" ; + }; + RadioButton RB_ANCHOR_FRAME + { + HelpID = "sw:RadioButton:TP_FRM_STD:RB_ANCHOR_FRAME"; + Pos = MAP_APPFONT ( 122 , 70 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + Text [ en-US ] = "To ~frame"; + }; + FixedLine FL_TYPE + { + Pos = MAP_APPFONT ( 116 , 3 ) ; + Size = MAP_APPFONT ( 80 , 8 ) ; + Text [ en-US ] = "Anchor" ; + }; + Window WN_BSP + { + Pos = MAP_APPFONT ( 202 , 14 ) ; + Size = MAP_APPFONT ( 52 , 86 ) ; + }; + FixedText FT_HORIZONTAL + { + Pos = MAP_APPFONT ( 12 , SWFRMPG_ROW_12 ) ; + Size = MAP_APPFONT ( 35 , RSC_CD_FIXEDTEXT_HEIGHT ) ; + Left = TRUE ; + Text [ en-US ] = "Hori~zontal" ; + }; + ListBox DLB_HORIZONTAL + { + HelpID = "sw:ListBox:TP_FRM_STD:DLB_HORIZONTAL"; + Pos = MAP_APPFONT ( 49 , SWFRMPG_ROW_11 ) ; + Size = MAP_APPFONT ( 50 , 60 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + FixedText FT_AT_HORZ_POS + { + Pos = MAP_APPFONT ( 101 , SWFRMPG_ROW_12 ) ; + Size = MAP_APPFONT ( 20 , RSC_CD_FIXEDLINE_HEIGHT ) ; + Center = TRUE ; + Text [ en-US ] = "b~y" ; + }; + MetricField ED_AT_HORZ_POS + { + HelpID = "sw:MetricField:TP_FRM_STD:ED_AT_HORZ_POS"; + Border = TRUE ; + Pos = MAP_APPFONT ( 123 , SWFRMPG_ROW_11 ) ; + Size = MAP_APPFONT ( 35 , RSC_CD_TEXTBOX_HEIGHT ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -9999 ; + Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + First = -9999 ; + Last = 9999 ; + SpinSize = 10 ; + }; + FixedText FT_HORI_RELATION + { + Pos = MAP_APPFONT ( 160 , SWFRMPG_ROW_12 ) ; + Size = MAP_APPFONT ( 21 , RSC_CD_FIXEDTEXT_HEIGHT ) ; + Center = TRUE ; + Text [ en-US ] = "~to" ; + }; + ListBox LB_HORI_RELATION + { + HelpID = "sw:ListBox:TP_FRM_STD:LB_HORI_RELATION"; + Pos = MAP_APPFONT ( 183 , SWFRMPG_ROW_11 ) ; + Size = MAP_APPFONT ( 65 , 60 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + CheckBox CB_MIRROR + { + HelpID = "sw:CheckBox:TP_FRM_STD:CB_MIRROR"; + Pos = MAP_APPFONT ( SWFRMPG_COL_2 , SWFRMPG_ROW_13 ) ; + Size = MAP_APPFONT ( (260-SWFRMPG_COL_2-1) , RSC_CD_CHECKBOX_HEIGHT ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Mirror on even pages" ; + }; + FixedText FT_VERTICAL + { + Pos = MAP_APPFONT ( 12 , SWFRMPG_ROW_15 ) ; + Size = MAP_APPFONT ( 35 , RSC_CD_FIXEDTEXT_HEIGHT ) ; + Left = TRUE ; + Text [ en-US ] = "~Vertical" ; + }; + ListBox DLB_VERTICAL + { + HelpID = "sw:ListBox:TP_FRM_STD:DLB_VERTICAL"; + Pos = MAP_APPFONT ( 49 , SWFRMPG_ROW_14 ) ; + Size = MAP_APPFONT ( 50 , 60 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + FixedText FT_AT_VERT_POS + { + Pos = MAP_APPFONT ( 101 , SWFRMPG_ROW_15 ) ; + Size = MAP_APPFONT ( 20 , RSC_CD_FIXEDTEXT_HEIGHT ) ; + Center = TRUE ; + Text [ en-US ] = "by" ; + }; + MetricField ED_AT_VERT_POS + { + HelpID = "sw:MetricField:TP_FRM_STD:ED_AT_VERT_POS"; + Border = TRUE ; + Pos = MAP_APPFONT ( 123 , SWFRMPG_ROW_14 ) ; + Size = MAP_APPFONT ( 35 , RSC_CD_TEXTBOX_HEIGHT ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Minimum = -9999 ; + Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + First = -9999 ; + Last = 9999 ; + SpinSize = 10 ; + }; + FixedText FT_VERT_RELATION + { + Pos = MAP_APPFONT ( 160 , SWFRMPG_ROW_15 ) ; + Size = MAP_APPFONT ( 21 , RSC_CD_FIXEDTEXT_HEIGHT ) ; + Center = TRUE ; + Text [ en-US ] = "t~o" ; + }; + ListBox LB_VERT_RELATION + { + HelpID = "sw:ListBox:TP_FRM_STD:LB_VERT_RELATION"; + Pos = MAP_APPFONT ( 183 , SWFRMPG_ROW_14 ) ; + Size = MAP_APPFONT ( 65 , 60 ) ; + TabStop = TRUE ; + DropDown = TRUE ; + }; + CheckBox CB_FOLLOWTEXTFLOW + { + HelpID = "sw:CheckBox:TP_FRM_STD:CB_FOLLOWTEXTFLOW"; + Pos = MAP_APPFONT ( SWFRMPG_COL_2 , SWFRMPG_ROW_16 ) ; + Size = MAP_APPFONT ( (260-SWFRMPG_COL_2-1) , RSC_CD_CHECKBOX_HEIGHT ) ; + TabStop = TRUE ; + Text [ en-US ] = "Follow text flow" ; + }; + FixedLine FL_POSITION + { + Pos = MAP_APPFONT ( 6 , SWFRMPG_ROW_10 ) ; + Size = MAP_APPFONT ( 248 , RSC_CD_FIXEDLINE_HEIGHT ) ; + Text [ en-US ] = "Position" ; + }; +}; +TabPage TP_GRF_EXT +{ + Hide = TRUE ; + HelpID = HID_GRF_EXT ; + SVLook = TRUE ; + Pos = MAP_APPFONT ( 0 , 0 ) ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Bitmap BMP_EXAMPLE + { + File = "dog.bmp" ; + }; + Bitmap BMP_EXAMPLE_HC + { + File = "dog_h.bmp" ; + }; + FixedLine FL_CONNECT + { + Pos = MAP_APPFONT ( 6 , 87 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Link" ; + }; + FixedText FT_CONNECT + { + Pos = MAP_APPFONT ( 13 , 98 ) ; + Size = MAP_APPFONT ( 80 , 8 ) ; + Text [ en-US ] = "~File name" ; + }; + Edit ED_CONNECT + { + HelpID = "sw:Edit:TP_GRF_EXT:ED_CONNECT"; + Pos = MAP_APPFONT ( 13 , 109 ) ; + Size = MAP_APPFONT ( 200 , 12 ) ; + Text [ en-US ] = "[None]" ; + Readonly = TRUE ; + Left = TRUE ; + Border = TRUE ; + }; + PushButton PB_BROWSE + { + HelpID = "sw:PushButton:TP_GRF_EXT:PB_BROWSE"; + Disable = TRUE ; + Pos = MAP_APPFONT ( 230 , 109 ) ; + Size = MAP_APPFONT ( 12 , 12 ) ; + Disable = TRUE ; + TabStop = TRUE ; + Text [ en-US ] = "~..." ; + }; + CheckBox CB_VERT + { + HelpID = "sw:CheckBox:TP_GRF_EXT:CB_VERT"; + Pos = MAP_APPFONT ( 12 , 14 ) ; + Size = MAP_APPFONT ( 48 , 10 ) ; + TabStop = TRUE ; + Group = TRUE ; + Text [ en-US ] = "~Vertically" ; + }; + CheckBox CB_HOR + { + HelpID = "sw:CheckBox:TP_GRF_EXT:CB_HOR"; + Pos = MAP_APPFONT ( 12 , 28 ) ; + Size = MAP_APPFONT ( 70 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Hori~zontally"; + }; + RadioButton RB_MIRROR_ALL_PAGES + { + HelpID = "sw:RadioButton:TP_GRF_EXT:RB_MIRROR_ALL_PAGES"; + Pos = MAP_APPFONT ( 18 , 42 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "On all pages" ; + }; + RadioButton RB_MIRROR_LEFT_PAGES + { + HelpID = "sw:RadioButton:TP_GRF_EXT:RB_MIRROR_LEFT_PAGES"; + Pos = MAP_APPFONT ( 18 , 56 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "On left pages" ; + }; + RadioButton RB_MIRROR_RIGHT_PAGES + { + HelpID = "sw:RadioButton:TP_GRF_EXT:RB_MIRROR_RIGHT_PAGES"; + Pos = MAP_APPFONT ( 18 , 70 ) ; + Size = MAP_APPFONT ( 100 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "On right pages" ; + }; + Window WN_BMP + { + Pos = MAP_APPFONT ( 120 , 14 ) ; + Size = MAP_APPFONT ( 127 , 66 ) ; + }; + FixedLine FL_MIRROR + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Flip" ; + }; +}; +String STR_EDIT_GRF +{ + Text [ en-US ] = "Link" ; +}; + +TabPage TP_FRM_URL +{ + Hide = TRUE ; + SVLook = TRUE ; + HelpID = HID_FRM_URL ; + Pos = MAP_APPFONT ( 0 , 0 ) ; + Size = MAP_APPFONT ( 260 , 185 ) ; + FixedText FT_URL + { + Pos = MAP_APPFONT ( 12 , 16 ) ; + Size = MAP_APPFONT ( 30 , 8 ) ; + Text [ en-US ] = "~URL" ; + }; + Edit ED_URL + { + HelpID = "sw:Edit:TP_FRM_URL:ED_URL"; + Pos = MAP_APPFONT ( 45 , 14 ) ; + Size = MAP_APPFONT ( 149 , 12 ) ; + Left = TRUE ; + Border = TRUE ; + TabStop = TRUE ; + }; + FixedText FT_NAME + { + Pos = MAP_APPFONT ( 12 , 32 ) ; + Size = MAP_APPFONT ( 30 , 8 ) ; + Text [ en-US ] = "~Name" ; + }; + Edit ED_NAME + { + HelpID = "sw:Edit:TP_FRM_URL:ED_NAME"; + Pos = MAP_APPFONT ( 45 , 30 ) ; + Size = MAP_APPFONT ( 149 , 12 ) ; + Left = TRUE ; + Border = TRUE ; + TabStop = TRUE ; + }; + FixedText FT_FRAME + { + Pos = MAP_APPFONT ( 12 , 48 ) ; + Size = MAP_APPFONT ( 30 , 8 ) ; + Text [ en-US ] = "Frame" ; + }; + ComboBox CB_FRAME + { + HelpID = "sw:ComboBox:TP_FRM_URL:CB_FRAME"; + Pos = MAP_APPFONT ( 45 , 46 ) ; + Size = MAP_APPFONT ( 89 , 50 ) ; + Left = TRUE ; + DropDown = TRUE ; + TabStop = TRUE ; + }; + PushButton PB_SEARCH + { + HelpID = "sw:PushButton:TP_FRM_URL:PB_SEARCH"; + Pos = MAP_APPFONT ( 198 , 13 ) ; + Size = MAP_APPFONT ( 50 , 14 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Browse..." ; + }; + FixedLine FL_HYPERLINK + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Link to"; + }; + CheckBox CB_SERVER + { + HelpID = "sw:CheckBox:TP_FRM_URL:CB_SERVER"; + Pos = MAP_APPFONT ( 12 , 75 ) ; + Size = MAP_APPFONT ( 236 , 10 ) ; + Text [ en-US ] = "~Server-side image map"; + }; + CheckBox CB_CLIENT + { + HelpID = "sw:CheckBox:TP_FRM_URL:CB_CLIENT"; + Pos = MAP_APPFONT ( 12 , 89 ) ; + Size = MAP_APPFONT ( 236 , 10 ) ; + Text [ en-US ] = "~Client-side image map"; + }; + FixedLine FL_IMAGE + { + Pos = MAP_APPFONT ( 6 , 64 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Image map" ; + }; +}; +TabPage TP_FRM_ADD +{ + Hide = TRUE ; + SVLook = TRUE ; + HelpID = HID_FRM_ADD ; + Pos = MAP_APPFONT ( 0 , 0 ) ; + Size = MAP_APPFONT ( 260 , 185 ) ; + FixedText FT_NAME + { + Pos = MAP_APPFONT ( 12 , 16 ) ; + Size = MAP_APPFONT ( 75 , 8 ) ; + Text [ en-US ] = "~Name" ; + }; + Edit ED_NAME + { + HelpID = "sw:Edit:TP_FRM_ADD:ED_NAME"; + Border = TRUE ; + Pos = MAP_APPFONT ( 91 , 14 ) ; + Size = MAP_APPFONT ( 157 , 12 ) ; + TabStop = TRUE ; + }; + FixedText FT_ALT_NAME + { + Pos = MAP_APPFONT ( 12 , 32 ) ; + Size = MAP_APPFONT ( 75 , 8 ) ; + Text [ en-US ] = "~Alternative (Text only)" ; + }; + Edit ED_ALT_NAME + { + HelpID = "sw:Edit:TP_FRM_ADD:ED_ALT_NAME"; + Border = TRUE ; + Pos = MAP_APPFONT ( 91 , 30 ) ; + Size = MAP_APPFONT ( 157 , 12 ) ; + TabStop = TRUE ; + }; + FixedText FT_PREV + { + Pos = MAP_APPFONT ( 12 , 48 ) ; + Size = MAP_APPFONT ( 75 , 8 ) ; + Text [ en-US ] = "~Previous link" ; + }; + ListBox LB_PREV + { + HelpID = "sw:ListBox:TP_FRM_ADD:LB_PREV"; + Border = TRUE ; + Pos = MAP_APPFONT ( 91 , 46 ) ; + Size = MAP_APPFONT ( 157 , 50 ) ; + TabStop = TRUE ; + DropDown = TRUE; + StringList [ en-US ] = + { + < "<None>" ; > ; + }; + }; + FixedText FT_NEXT + { + Pos = MAP_APPFONT ( 12 , 64 ) ; + Size = MAP_APPFONT ( 75 , 8 ) ; + Text [ en-US ] = "~Next link" ; + }; + ListBox LB_NEXT + { + HelpID = "sw:ListBox:TP_FRM_ADD:LB_NEXT"; + Border = TRUE ; + Pos = MAP_APPFONT ( 91 , 62 ) ; + Size = MAP_APPFONT ( 157 , 50 ) ; + Border = TRUE; + DropDown = TRUE; + StringList [ en-US ] = + { + < "<None>" ; > ; + }; + }; + FixedLine FL_NAME + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Names" ; + }; + CheckBox CB_PROTECT_CONTENT + { + HelpID = "sw:CheckBox:TP_FRM_ADD:CB_PROTECT_CONTENT"; + Pos = MAP_APPFONT ( 12 , 91 ) ; + Size = MAP_APPFONT ( 80 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Contents" ; + }; + CheckBox CB_PROTECT_FRAME + { + HelpID = "sw:CheckBox:TP_FRM_ADD:CB_PROTECT_FRAME"; + Pos = MAP_APPFONT ( 12 , 105 ) ; + Size = MAP_APPFONT ( 80 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "P~osition" ; + }; + CheckBox CB_PROTECT_SIZE + { + HelpID = "sw:CheckBox:TP_FRM_ADD:CB_PROTECT_SIZE"; + Pos = MAP_APPFONT ( 12 , 119 ) ; + Size = MAP_APPFONT ( 80 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Size" ; + }; + FixedLine FL_PROTECT + { + Pos = MAP_APPFONT ( 6 , 80 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Protect" ; + }; + CheckBox CB_EDIT_IN_READONLY + { + HelpID = "sw:CheckBox:TP_FRM_ADD:CB_EDIT_IN_READONLY"; + Pos = MAP_APPFONT ( 12 , 146 ) ; + Size = MAP_APPFONT ( 236 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "~Editable in read-only document" ; + }; + CheckBox CB_PRINT_FRAME + { + HelpID = "sw:CheckBox:TP_FRM_ADD:CB_PRINT_FRAME"; + Pos = MAP_APPFONT ( 12 , 160 ) ; + Size = MAP_APPFONT ( 236 , 10 ) ; + TabStop = TRUE ; + Text [ en-US ] = "Prin~t" ; + }; + FixedLine FL_EXT + { + Pos = MAP_APPFONT ( 6 , 135 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Properties"; + }; + + FixedText FT_TEXTFLOW + { + Pos = MAP_APPFONT ( 12 , 174 ) ; + Size = MAP_APPFONT ( 65 , 8 ) ; + Left = TRUE ; + Hide = TRUE ; + Text [ en-US ] = "~Text direction"; + }; + ListBox LB_TEXTFLOW + { + HelpID = "sw:ListBox:TP_FRM_ADD:LB_TEXTFLOW"; + Border = TRUE ; + Pos = MAP_APPFONT ( 81 , 172 ) ; + Size = MAP_APPFONT ( 167 , 50 ) ; + DropDown = TRUE ; + Hide = TRUE ; + StringList [ en-US ] = + { + < "Left-to-right (horizontal)" ; 0; > ; + < "Right-to-left (horizontal)" ; 1; > ; + < "Right-to-left (vertical)" ; 2; > ; + < "Use superordinate object settings" ; 4; > ; + }; + }; +}; + diff --git a/sw/source/ui/frmdlg/frmui.src b/sw/source/ui/frmdlg/frmui.src new file mode 100644 index 000000000000..5e3abb1286e4 --- /dev/null +++ b/sw/source/ui/frmdlg/frmui.src @@ -0,0 +1,133 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#include "frmui.hrc" + +/*----------------------------------------------------------------------- + Beschreibung: V-Align + -----------------------------------------------------------------------*/ +String STR_TOP +{ + Text [ en-US ] = "~Top" ; +}; +String STR_BOTTOM +{ + Text [ en-US ] = "~Bottom" ; +}; +String STR_CENTER_VERT +{ + Text [ en-US ] = "C~enter" ; +}; +String STR_CENTER_HORI +{ + Text [ en-US ] = "~Center" ; +}; +/*----------------------------------------------------------------------- + Beschreibung: V-Rel + -----------------------------------------------------------------------*/ +String STR_TOPPRT +{ + Text [ en-US ] = "Upper Margin" ; +}; + +/*----------------------------------------------------------------------- + Beschreibung: H-Rel + -----------------------------------------------------------------------*/ +/*----------------------------------------------------------------------- + Beschreibung: V-Rel Zeichenausrichtungen + -----------------------------------------------------------------------*/ +/*----------------------------------------------------------------------- + Beschreibung: Zeichenausrichtungen fuer frmsh.cxx - Kontextmenue + -----------------------------------------------------------------------*/ +String STR_TOP_BASE +{ + Text [ en-US ] = "Base line at ~top" ; +}; +String STR_BOTTOM_BASE +{ + Text [ en-US ] = "~Base line at bottom" ; +}; +String STR_CENTER_BASE +{ + Text [ en-US ] = "Base line ~centered" ; +}; +String STR_LINE_TOP +{ + Text [ en-US ] = "Top of line" ; +}; +String STR_LINE_BOTTOM +{ + Text [ en-US ] = "Bottom of line" ; +}; +String STR_LINE_CENTER +{ + Text [ en-US ] = "Center of line" ; +}; +String STR_CHAR_TOP +{ + Text [ en-US ] = "Top of character" ; +}; +String STR_CHAR_BOTTOM +{ + Text [ en-US ] = "Bottom of character" ; +}; +String STR_CHAR_CENTER +{ + Text [ en-US ] = "Center of character" ; +}; +String STR_OLE_INSERT +{ + /* ### ACHTUNG: Neuer Text in Resource? Objekt einfügen : Objekt einf³gen */ + Text [ en-US ] = "Insert object" ; +}; +String STR_OLE_EDIT +{ + Text [ en-US ] = "Edit object" ; +}; +String STR_COLL_HEADER +{ + Text [ en-US ] = " (Template: " ; +}; +String STR_FRMUI_BORDER +{ + Text [ en-US ] = "Borders" ; +}; +String STR_FRMUI_PATTERN +{ + Text [ en-US ] = "Background" ; +}; +String STR_FRMUI_WRAP +{ + Text [ en-US ] = "Wrap" ; +}; +InfoBox MSG_COLUMN_ERR_BOUNDWIDTH +{ + BUTTONS = WB_OK ; + DEFBUTTON = WB_DEF_OK ; + /* ### ACHTUNG: Neuer Text in Resource? Der Spaltenabstand ist zu groß für die Spaltenbreite. : Der Spaltenabstand ist zu gro˜ f³r die Spaltenbreite. */ + Message [ en-US ] = "Column spacing exceeds the column width." ; +}; + diff --git a/sw/source/ui/frmdlg/pattern.cxx b/sw/source/ui/frmdlg/pattern.cxx new file mode 100644 index 000000000000..9b2de83e8f59 --- /dev/null +++ b/sw/source/ui/frmdlg/pattern.cxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + + + +#include <svx/svxdlg.hxx> +#include <svx/dialogs.hrc> +#include "swtypes.hxx" +#include "pattern.hxx" +#include "frmui.hrc" + + +/**************************************************************************** +Ctor +****************************************************************************/ + + + +SwBackgroundDlg::SwBackgroundDlg(Window* pParent, const SfxItemSet& rSet) : + + SfxSingleTabDialog(pParent, rSet, 0) + +{ + SetText(SW_RESSTR(STR_FRMUI_PATTERN)); + SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!"); + ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BACKGROUND ); + if ( fnCreatePage ) + { + SetTabPage((*fnCreatePage)( this, rSet )); + } + +} + +/**************************************************************************** +Dtor +****************************************************************************/ + + + +SwBackgroundDlg::~SwBackgroundDlg() +{ +} + diff --git a/sw/source/ui/frmdlg/pattern.hrc b/sw/source/ui/frmdlg/pattern.hrc new file mode 100644 index 000000000000..f9eabe9bb3c5 --- /dev/null +++ b/sw/source/ui/frmdlg/pattern.hrc @@ -0,0 +1,46 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#define BRUSH_LBL 1 +#define BRUSH_LBOX 2 + +#define COLOR_LBL 3 +#define COLOR_LBOX 4 + +#define FILLIN_COLOR_LBL 5 +#define FILLIN_COLOR_LBOX 6 + +#define NO_PATTERN_BOX 7 + +#define PATTERN_FRM 8 +#define EXAMPLE_FRM 9 +#define EXAMPLE_WIN 10 + +#define OK_BTN 11 +#define CANCEL_BTN 12 +#define RESET_BTN 13 + diff --git a/sw/source/ui/frmdlg/uiborder.cxx b/sw/source/ui/frmdlg/uiborder.cxx new file mode 100644 index 000000000000..8a7ddfd6b5f9 --- /dev/null +++ b/sw/source/ui/frmdlg/uiborder.cxx @@ -0,0 +1,79 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + +#include <svx/svxdlg.hxx> +#include <svx/svxids.hrc> +#include <svx/dialogs.hrc> +#include <svl/itemset.hxx> +#include <svx/flagsdef.hxx> +#include <sfx2/tabdlg.hxx> +#include <svl/intitem.hxx> + +#include "swtypes.hxx" +#include "uiborder.hxx" +#include "frmui.hrc" + + + + +SwBorderDlg::SwBorderDlg(Window* pParent, SfxItemSet& rSet, sal_uInt16 nType) : + + SfxSingleTabDialog(pParent, rSet, 0) + +{ + SetText(SW_RESSTR(STR_FRMUI_BORDER)); + + // TabPage erzeugen + SfxAbstractDialogFactory* pFact = SfxAbstractDialogFactory::Create(); + DBG_ASSERT(pFact, "Dialogdiet fail!"); + ::CreateTabPage fnCreatePage = pFact->GetTabPageCreatorFunc( RID_SVXPAGE_BORDER ); + if ( fnCreatePage ) + { + SfxTabPage* pNewPage = (*fnCreatePage)( this, rSet ); + SfxAllItemSet aSet(*(rSet.GetPool())); + aSet.Put (SfxUInt16Item(SID_SWMODE_TYPE,nType)); + if(SW_BORDER_MODE_TABLE == nType) + aSet.Put (SfxUInt32Item(SID_FLAG_TYPE,SVX_HIDESHADOWCTL)); + pNewPage->PageCreated(aSet); + SetTabPage(pNewPage); + } +} + + + +SwBorderDlg::~SwBorderDlg() +{ +} + + diff --git a/sw/source/ui/frmdlg/wrap.cxx b/sw/source/ui/frmdlg/wrap.cxx new file mode 100644 index 000000000000..fc988a3ab0e6 --- /dev/null +++ b/sw/source/ui/frmdlg/wrap.cxx @@ -0,0 +1,785 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_sw.hxx" + +#ifdef SW_DLLIMPLEMENTATION +#undef SW_DLLIMPLEMENTATION +#endif + + +#include "hintids.hxx" +#include <vcl/graph.hxx> +#include <svx/htmlmode.hxx> +#include <sfx2/objsh.hxx> +#include <svl/intitem.hxx> +#include <editeng/opaqitem.hxx> +#include <editeng/ulspitem.hxx> +#include <editeng/lrspitem.hxx> +// OD 18.09.2003 #i18732# +#include <fmtfollowtextflow.hxx> +#include <svx/swframevalidation.hxx> + + +#include "cmdid.h" +#include "uitool.hxx" +#include "wrtsh.hxx" +#include "swmodule.hxx" +#include "viewopt.hxx" +#include "frmatr.hxx" +#include "frmmgr.hxx" +#include "globals.hrc" +#include "frmui.hrc" +#include "wrap.hrc" +#include "wrap.hxx" + +using namespace ::com::sun::star; + + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + +static sal_uInt16 __FAR_DATA aWrapPageRg[] = { + RES_LR_SPACE, RES_UL_SPACE, + RES_PROTECT, RES_SURROUND, + RES_PRINT, RES_PRINT, + 0 +}; + + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + + + +SwWrapDlg::SwWrapDlg(Window* pParent, SfxItemSet& rSet, SwWrtShell* pSh, sal_Bool bDrawMode) : + SfxSingleTabDialog(pParent, rSet, 0), + pWrtShell(pSh) + +{ + // TabPage erzeugen + SwWrapTabPage* pNewPage = (SwWrapTabPage*) SwWrapTabPage::Create(this, rSet); + pNewPage->SetFormatUsed(sal_False, bDrawMode); + pNewPage->SetShell(pWrtShell); + SetTabPage(pNewPage); + + String sTitle(SW_RES(STR_FRMUI_WRAP)); + SetText(sTitle); +} + + + +SwWrapDlg::~SwWrapDlg() +{ +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + + + +SwWrapTabPage::SwWrapTabPage(Window *pParent, const SfxItemSet &rSet) : + SfxTabPage(pParent, SW_RES(TP_FRM_WRAP), rSet), + + aWrapFLC (this, SW_RES(C_WRAP_FL)), + aNoWrapRB (this, SW_RES(RB_NO_WRAP)), + aWrapLeftRB (this, SW_RES(RB_WRAP_LEFT)), + aWrapRightRB (this, SW_RES(RB_WRAP_RIGHT)), + aWrapParallelRB (this, SW_RES(RB_WRAP_PARALLEL)), + aWrapThroughRB (this, SW_RES(RB_WRAP_THROUGH)), + aIdealWrapRB (this, SW_RES(RB_WRAP_IDEAL)), + + aMarginFL (this, SW_RES(FL_MARGIN)), + aLeftMarginFT (this, SW_RES(FT_LEFT_MARGIN)), + aLeftMarginED (this, SW_RES(ED_LEFT_MARGIN)), + aRightMarginFT (this, SW_RES(FT_RIGHT_MARGIN)), + aRightMarginED (this, SW_RES(ED_RIGHT_MARGIN)), + aTopMarginFT (this, SW_RES(FT_TOP_MARGIN)), + aTopMarginED (this, SW_RES(ED_TOP_MARGIN)), + aBottomMarginFT (this, SW_RES(FT_BOTTOM_MARGIN)), + aBottomMarginED (this, SW_RES(ED_BOTTOM_MARGIN)), + + aOptionsSepFL (this, SW_RES(FL_OPTION_SEP)), + aOptionsFL (this, SW_RES(FL_OPTION)), + aWrapAnchorOnlyCB (this, SW_RES(CB_ANCHOR_ONLY)), + aWrapTransparentCB (this, SW_RES(CB_TRANSPARENT)), + aWrapOutlineCB (this, SW_RES(CB_OUTLINE)), + aWrapOutsideCB (this, SW_RES(CB_ONLYOUTSIDE)), + + aWrapIL (SW_RES(IL_WRAP)), + aWrapILH (SW_RES(ILH_WRAP)), + + nAnchorId(FLY_AT_PARA), + nHtmlMode(0), + + pWrtSh(0), + + bFormat(sal_False), + bNew(sal_True), + bHtmlMode(sal_False), + bContourImage(sal_False) + +{ + FreeResource(); + SetExchangeSupport(); + + Link aLk = LINK(this, SwWrapTabPage, RangeModifyHdl); + aLeftMarginED.SetUpHdl(aLk); + aLeftMarginED.SetDownHdl(aLk); + aLeftMarginED.SetFirstHdl(aLk); + aLeftMarginED.SetLastHdl(aLk); + aLeftMarginED.SetLoseFocusHdl(aLk); + + aRightMarginED.SetUpHdl(aLk); + aRightMarginED.SetDownHdl(aLk); + aRightMarginED.SetFirstHdl(aLk); + aRightMarginED.SetLastHdl(aLk); + aRightMarginED.SetLoseFocusHdl(aLk); + + aTopMarginED.SetUpHdl(aLk); + aTopMarginED.SetDownHdl(aLk); + aTopMarginED.SetFirstHdl(aLk); + aTopMarginED.SetLastHdl(aLk); + aTopMarginED.SetLoseFocusHdl(aLk); + + aBottomMarginED.SetUpHdl(aLk); + aBottomMarginED.SetDownHdl(aLk); + aBottomMarginED.SetFirstHdl(aLk); + aBottomMarginED.SetLastHdl(aLk); + aBottomMarginED.SetLoseFocusHdl(aLk); + + aLk = LINK(this, SwWrapTabPage, WrapTypeHdl); + aNoWrapRB.SetClickHdl(aLk); + aWrapLeftRB.SetClickHdl(aLk); + aWrapRightRB.SetClickHdl(aLk); + aWrapParallelRB.SetClickHdl(aLk); + aWrapThroughRB.SetClickHdl(aLk); + aIdealWrapRB.SetClickHdl(aLk); + ApplyImageList(); + aWrapOutlineCB.SetClickHdl(LINK(this, SwWrapTabPage, ContourHdl)); +} + + + +SwWrapTabPage::~SwWrapTabPage() +{ +} + + + +SfxTabPage* SwWrapTabPage::Create(Window *pParent, const SfxItemSet &rSet) +{ + return new SwWrapTabPage(pParent, rSet); +} +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + + + +void SwWrapTabPage::Reset(const SfxItemSet &rSet) +{ + //Contour fuer Draw, Grafik und OLE (Einfuegen/Grafik/Eigenschaften fehlt noch!) + if( bDrawMode ) + { + aWrapOutlineCB.Show(); + aWrapOutsideCB.Show(); + + aWrapTransparentCB.Check( 0 == ((const SfxInt16Item&)rSet.Get( + FN_DRAW_WRAP_DLG)).GetValue() ); + aWrapTransparentCB.SaveValue(); + } + else + { + sal_Bool bShowCB = bFormat; + if( !bFormat ) + { + int nSelType = pWrtSh->GetSelectionType(); + if( ( nSelType & nsSelectionType::SEL_GRF ) || + ( nSelType & nsSelectionType::SEL_OLE && GRAPHIC_NONE != + pWrtSh->GetIMapGraphic().GetType() )) + bShowCB = sal_True; + } + if( bShowCB ) + { + aWrapOutlineCB.Show(); + aWrapOutsideCB.Show(); + } + } + + nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current()); + bHtmlMode = nHtmlMode & HTMLMODE_ON ? sal_True : sal_False; + + FieldUnit aMetric = ::GetDfltMetric(bHtmlMode); + SetMetric( aLeftMarginED , aMetric ); + SetMetric( aRightMarginED , aMetric ); + SetMetric( aTopMarginED , aMetric ); + SetMetric( aBottomMarginED, aMetric ); + + const SwFmtSurround& rSurround = (const SwFmtSurround&)rSet.Get(RES_SURROUND); + + SwSurround nSur = rSurround.GetSurround(); + const SwFmtAnchor &rAnch = (const SwFmtAnchor&)rSet.Get(RES_ANCHOR); + nAnchorId = rAnch.GetAnchorId(); + + if (((nAnchorId == FLY_AT_PARA) || (nAnchorId == FLY_AT_CHAR)) + && (nSur != SURROUND_NONE)) + { + aWrapAnchorOnlyCB.Check( rSurround.IsAnchorOnly() ); + } + else + { + aWrapAnchorOnlyCB.Enable( sal_False ); + } + + sal_Bool bContour = rSurround.IsContour(); + aWrapOutlineCB.Check( bContour ); + aWrapOutsideCB.Check( rSurround.IsOutside() ); + aWrapThroughRB.Enable(!aWrapOutlineCB.IsChecked()); + bContourImage = !bContour; + + ImageRadioButton* pBtn = NULL; + + switch (nSur) + { + case SURROUND_NONE: + { + pBtn = &aNoWrapRB; + break; + } + + case SURROUND_THROUGHT: + { + // transparent ? + pBtn = &aWrapThroughRB; + + if (!bDrawMode) + { + const SvxOpaqueItem& rOpaque = (const SvxOpaqueItem&)rSet.Get(RES_OPAQUE); + aWrapTransparentCB.Check(!rOpaque.GetValue()); + } + break; + } + + case SURROUND_PARALLEL: + { + pBtn = &aWrapParallelRB; + break; + } + + case SURROUND_IDEAL: + { + pBtn = &aIdealWrapRB; + break; + } + + default: + { + if (nSur == SURROUND_LEFT) + pBtn = &aWrapLeftRB; + else if (nSur == SURROUND_RIGHT) + pBtn = &aWrapRightRB; + } + } + if (pBtn) + { + pBtn->Check(); + WrapTypeHdl(pBtn); + // Hier wird fuer Zeichenobjekte, die im Moment auf Durchlauf stehen, + // schon mal der Default "Kontur an" vorbereitet, falls man spaeter auf + // irgendeinen Umlauf umschaltet. + if (bDrawMode && !aWrapOutlineCB.IsEnabled()) + aWrapOutlineCB.Check(); + } + aWrapTransparentCB.Enable( pBtn == &aWrapThroughRB && !bHtmlMode ); + + const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)rSet.Get(RES_UL_SPACE); + const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)rSet.Get(RES_LR_SPACE); + + // Abstand zum Text + aLeftMarginED.SetValue(aLeftMarginED.Normalize(rLR.GetLeft()), FUNIT_TWIP); + aRightMarginED.SetValue(aRightMarginED.Normalize(rLR.GetRight()), FUNIT_TWIP); + aTopMarginED.SetValue(aTopMarginED.Normalize(rUL.GetUpper()), FUNIT_TWIP); + aBottomMarginED.SetValue(aBottomMarginED.Normalize(rUL.GetLower()), FUNIT_TWIP); + + ContourHdl(0); + ActivatePage( rSet ); +} + +/*-------------------------------------------------------------------- + Beschreibung: Attribute in den Set stopfen bei OK + --------------------------------------------------------------------*/ + + + +sal_Bool SwWrapTabPage::FillItemSet(SfxItemSet &rSet) +{ + sal_Bool bModified = sal_False; + const SfxPoolItem* pOldItem; + + const SwFmtSurround& rOldSur = (const SwFmtSurround&)GetItemSet().Get(RES_SURROUND); + SwFmtSurround aSur( rOldSur ); + + SvxOpaqueItem aOp( RES_OPAQUE); + + if (!bDrawMode) + { + const SvxOpaqueItem& rOpaque = (const SvxOpaqueItem&)GetItemSet().Get(RES_OPAQUE); + aOp = rOpaque; + aOp.SetValue(sal_True); + } + + if (aNoWrapRB.IsChecked()) + aSur.SetSurround(SURROUND_NONE); + else if (aWrapLeftRB.IsChecked()) + aSur.SetSurround(SURROUND_LEFT); + else if (aWrapRightRB.IsChecked()) + aSur.SetSurround(SURROUND_RIGHT); + else if (aWrapParallelRB.IsChecked()) + aSur.SetSurround(SURROUND_PARALLEL); + else if (aWrapThroughRB.IsChecked()) + { + aSur.SetSurround(SURROUND_THROUGHT); + if (aWrapTransparentCB.IsChecked() && !bDrawMode) + aOp.SetValue(sal_False); + } + else if (aIdealWrapRB.IsChecked()) + aSur.SetSurround(SURROUND_IDEAL); + + aSur.SetAnchorOnly( aWrapAnchorOnlyCB.IsChecked() ); + sal_Bool bContour = aWrapOutlineCB.IsChecked() && aWrapOutlineCB.IsEnabled(); + aSur.SetContour( bContour ); + + if ( bContour ) + aSur.SetOutside(aWrapOutsideCB.IsChecked()); + + if(0 == (pOldItem = GetOldItem( rSet, RES_SURROUND )) || + aSur != *pOldItem ) + { + rSet.Put(aSur); + bModified = sal_True; + } + + if (!bDrawMode) + { + if(0 == (pOldItem = GetOldItem( rSet, FN_OPAQUE )) || + aOp != *pOldItem ) + { + rSet.Put(aOp); + bModified = sal_True; + } + } + + sal_Bool bTopMod = aTopMarginED.IsValueModified(); + sal_Bool bBottomMod = aBottomMarginED.IsValueModified(); + + SvxULSpaceItem aUL( RES_UL_SPACE ); + aUL.SetUpper((sal_uInt16)aTopMarginED.Denormalize(aTopMarginED.GetValue(FUNIT_TWIP))); + aUL.SetLower((sal_uInt16)aBottomMarginED.Denormalize(aBottomMarginED.GetValue(FUNIT_TWIP))); + + if ( bTopMod || bBottomMod ) + { + if(0 == (pOldItem = GetOldItem(rSet, RES_UL_SPACE)) || + aUL != *pOldItem ) + { + rSet.Put( aUL, RES_UL_SPACE ); + bModified = sal_True; + } + } + + sal_Bool bLeftMod = aLeftMarginED.IsValueModified(); + sal_Bool bRightMod = aRightMarginED.IsValueModified(); + + SvxLRSpaceItem aLR( RES_LR_SPACE ); + aLR.SetLeft((sal_uInt16)aLeftMarginED.Denormalize(aLeftMarginED.GetValue(FUNIT_TWIP))); + aLR.SetRight((sal_uInt16)aRightMarginED.Denormalize(aRightMarginED.GetValue(FUNIT_TWIP))); + + if ( bLeftMod || bRightMod ) + { + if( 0 == (pOldItem = GetOldItem(rSet, RES_LR_SPACE)) || + aLR != *pOldItem ) + { + rSet.Put(aLR, RES_LR_SPACE); + bModified = sal_True; + } + } + + if ( bDrawMode ) + { + sal_Bool bChecked = aWrapTransparentCB.IsChecked() & aWrapTransparentCB.IsEnabled(); + if (aWrapTransparentCB.GetSavedValue() != bChecked) + bModified |= 0 != rSet.Put(SfxInt16Item(FN_DRAW_WRAP_DLG, bChecked ? 0 : 1)); + } + + return bModified; +} + +/*-------------------------------------------------------------------- + Beschreibung: Bsp - Update + --------------------------------------------------------------------*/ + + + +void SwWrapTabPage::ActivatePage(const SfxItemSet& rSet) +{ + // Anchor + const SwFmtAnchor &rAnch = (const SwFmtAnchor&)rSet.Get(RES_ANCHOR); + nAnchorId = rAnch.GetAnchorId(); + sal_Bool bEnable = (nAnchorId != FLY_AS_CHAR); + + if (!bDrawMode) + { + SwWrtShell* pSh = bFormat ? ::GetActiveWrtShell() : pWrtSh; + SwFlyFrmAttrMgr aMgr( bNew, pSh, (const SwAttrSet&)GetItemSet() ); + SvxSwFrameValidation aVal; + + // Size + const SwFmtFrmSize& rFrmSize = (const SwFmtFrmSize&)rSet.Get(RES_FRM_SIZE); + Size aSize = rFrmSize.GetSize(); + + // Rand + const SvxULSpaceItem& rUL = (const SvxULSpaceItem&)rSet.Get(RES_UL_SPACE); + const SvxLRSpaceItem& rLR = (const SvxLRSpaceItem&)rSet.Get(RES_LR_SPACE); + nOldLeftMargin = static_cast< sal_uInt16 >(rLR.GetLeft()); + nOldRightMargin = static_cast< sal_uInt16 >(rLR.GetRight()); + nOldUpperMargin = static_cast< sal_uInt16 >(rUL.GetUpper()); + nOldLowerMargin = static_cast< sal_uInt16 >(rUL.GetLower()); + + // Position + const SwFmtHoriOrient& rHori = (const SwFmtHoriOrient&)rSet.Get(RES_HORI_ORIENT); + const SwFmtVertOrient& rVert = (const SwFmtVertOrient&)rSet.Get(RES_VERT_ORIENT); + + aVal.nAnchorType = static_cast< sal_Int16 >(nAnchorId); + aVal.bAutoHeight = rFrmSize.GetHeightSizeType() == ATT_MIN_SIZE; + aVal.bAutoWidth = rFrmSize.GetWidthSizeType() == ATT_MIN_SIZE; + aVal.bMirror = rHori.IsPosToggle(); + // OD 18.09.2003 #i18732# + aVal.bFollowTextFlow = + static_cast<const SwFmtFollowTextFlow&>(rSet.Get(RES_FOLLOW_TEXT_FLOW)).GetValue(); + + aVal.nHoriOrient = (short)rHori.GetHoriOrient(); + aVal.nVertOrient = (short)rVert.GetVertOrient(); + + aVal.nHPos = rHori.GetPos(); + aVal.nHRelOrient = rHori.GetRelationOrient(); + aVal.nVPos = rVert.GetPos(); + aVal.nVRelOrient = rVert.GetRelationOrient(); + + if (rFrmSize.GetWidthPercent() && rFrmSize.GetWidthPercent() != 0xff) + aSize.Width() = aSize.Width() * rFrmSize.GetWidthPercent() / 100; + + if (rFrmSize.GetHeightPercent() && rFrmSize.GetHeightPercent() != 0xff) + aSize.Height() = aSize.Height() * rFrmSize.GetHeightPercent() / 100; + + aVal.nWidth = aSize.Width(); + aVal.nHeight = aSize.Height(); + aFrmSize = aSize; + + aMgr.ValidateMetrics(aVal, 0); + + SwTwips nLeft; + SwTwips nRight; + SwTwips nTop; + SwTwips nBottom; + + nLeft = aVal.nHPos - aVal.nMinHPos; + nRight = aVal.nMaxWidth - aVal.nWidth; + nTop = aVal.nVPos - aVal.nMinVPos; + nBottom = aVal.nMaxHeight - aVal.nHeight; + + if (bHtmlMode && 0 == (nHtmlMode & HTMLMODE_FULL_ABS_POS)) + { + nLeft = nRight = ( nLeft + nRight ) / 2; + nTop = nBottom = ( nTop + nBottom ) / 2; + } + else + { + if (aVal.nAnchorType == FLY_AS_CHAR) + { + nLeft = nRight; + + if (aVal.nVPos < 0) + { + if (aVal.nVPos <= aVal.nMaxHeight) + nTop = aVal.nMaxVPos - aVal.nHeight; + else + nTop = nBottom = 0; // Kein Umlauf + } + else + nTop = aVal.nMaxVPos - aVal.nHeight - aVal.nVPos; + } + else + { + nLeft += nRight; + nTop += nBottom; + } + + nBottom = nTop; + nRight = nLeft; + } + + aLeftMarginED.SetMax(aLeftMarginED.Normalize(nLeft), FUNIT_TWIP); + aRightMarginED.SetMax(aRightMarginED.Normalize(nRight), FUNIT_TWIP); + + aTopMarginED.SetMax(aTopMarginED.Normalize(nTop), FUNIT_TWIP); + aBottomMarginED.SetMax(aBottomMarginED.Normalize(nBottom), FUNIT_TWIP); + + RangeModifyHdl(&aLeftMarginED); + RangeModifyHdl(&aTopMarginED); + } + + const SwFmtSurround& rSurround = (const SwFmtSurround&)rSet.Get(RES_SURROUND); + SwSurround nSur = rSurround.GetSurround(); + + aWrapTransparentCB.Enable( bEnable && !bHtmlMode && nSur == SURROUND_THROUGHT ); + if(bHtmlMode) + { + sal_Bool bSomeAbsPos = 0 != (nHtmlMode & HTMLMODE_SOME_ABS_POS); + const SwFmtHoriOrient& rHori = (const SwFmtHoriOrient&)rSet.Get(RES_HORI_ORIENT); + sal_Int16 eHOrient = rHori.GetHoriOrient(); + sal_Int16 eHRelOrient = rHori.GetRelationOrient(); + aWrapOutlineCB.Hide(); + const bool bAllHtmlModes = + ((nAnchorId == FLY_AT_PARA) || (nAnchorId == FLY_AT_CHAR)) && + (eHOrient == text::HoriOrientation::RIGHT || eHOrient == text::HoriOrientation::LEFT); + aWrapAnchorOnlyCB.Enable( bAllHtmlModes && nSur != SURROUND_NONE ); + aWrapOutsideCB.Hide(); + aIdealWrapRB.Enable( sal_False ); + + + aWrapTransparentCB.Enable( sal_False ); + aNoWrapRB.Enable( FLY_AT_PARA == nAnchorId ); + aWrapParallelRB.Enable( sal_False ); + aWrapLeftRB .Enable + ( (FLY_AT_PARA == nAnchorId) + || ( (FLY_AT_CHAR == nAnchorId) + && (eHOrient == text::HoriOrientation::RIGHT) + && (eHRelOrient == text::RelOrientation::PRINT_AREA))); + aWrapRightRB .Enable + ( (FLY_AT_PARA == nAnchorId) + || ( (FLY_AT_CHAR == nAnchorId) + && (eHOrient == text::HoriOrientation::LEFT) + && (eHRelOrient == text::RelOrientation::PRINT_AREA))); + + aWrapThroughRB.Enable + ( ( (FLY_AT_PAGE == nAnchorId) + || ( (FLY_AT_CHAR == nAnchorId) + && (eHRelOrient != text::RelOrientation::PRINT_AREA)) + || (FLY_AT_PARA == nAnchorId)) + && bSomeAbsPos + && (eHOrient != text::HoriOrientation::RIGHT)); + if(aNoWrapRB.IsChecked() && !aNoWrapRB.IsEnabled()) + { + if(aWrapThroughRB.IsEnabled()) + aWrapThroughRB.Check(sal_True); + else if(aWrapLeftRB.IsEnabled()) + aWrapLeftRB.Check(); + else if(aWrapRightRB.IsEnabled()) + aWrapRightRB.Check(); + + } + if(aWrapLeftRB.IsChecked() && !aWrapLeftRB.IsEnabled()) + { + if(aWrapRightRB.IsEnabled()) + aWrapRightRB.Check(); + else if(aWrapThroughRB.IsEnabled()) + aWrapThroughRB.Check(); + } + if(aWrapRightRB.IsChecked() && !aWrapRightRB.IsEnabled()) + { + if(aWrapLeftRB.IsEnabled()) + aWrapLeftRB.Check(); + else if(aWrapThroughRB.IsEnabled()) + aWrapThroughRB.Check(); + } + if(aWrapThroughRB.IsChecked() && !aWrapThroughRB.IsEnabled()) + if(aNoWrapRB.IsEnabled()) + aNoWrapRB.Check(); + + if(aWrapParallelRB.IsChecked() && !aWrapParallelRB.IsEnabled()) + aWrapThroughRB.Check(); + } + else + { + aNoWrapRB.Enable( bEnable ); + aWrapLeftRB.Enable( bEnable ); + aWrapRightRB.Enable( bEnable ); + aIdealWrapRB.Enable( bEnable ); + aWrapThroughRB.Enable( bEnable ); + aWrapParallelRB.Enable( bEnable ); + aWrapAnchorOnlyCB.Enable( + ((nAnchorId == FLY_AT_PARA) || (nAnchorId == FLY_AT_CHAR)) + && nSur != SURROUND_NONE ); + } + ContourHdl(0); +} + + + +int SwWrapTabPage::DeactivatePage(SfxItemSet* _pSet) +{ + if(_pSet) + FillItemSet(*_pSet); + + return sal_True; +} + +/*-------------------------------------------------------------------- + Beschreibung: Bereichspruefung + --------------------------------------------------------------------*/ + + + +IMPL_LINK( SwWrapTabPage, RangeModifyHdl, MetricField *, pEdit ) +{ + if(bHtmlMode && 0 == (nHtmlMode & HTMLMODE_FULL_ABS_POS)) + { + sal_Int64 nValue = pEdit->GetValue(); + if (pEdit == &aLeftMarginED) + aRightMarginED.SetUserValue(nValue, FUNIT_NONE); + else if (pEdit == &aRightMarginED) + aLeftMarginED.SetUserValue(nValue, FUNIT_NONE); + else if (pEdit == &aTopMarginED) + aBottomMarginED.SetUserValue(nValue, FUNIT_NONE); + else if (pEdit == &aBottomMarginED) + aTopMarginED.SetUserValue(nValue, FUNIT_NONE); + } + else + { + sal_Int64 nValue = pEdit->GetValue(); + MetricField *pOpposite = 0; + + if (pEdit == &aLeftMarginED) + pOpposite = &aRightMarginED; + else if (pEdit == &aRightMarginED) + pOpposite = &aLeftMarginED; + else if (pEdit == &aTopMarginED) + pOpposite = &aBottomMarginED; + else if (pEdit == &aBottomMarginED) + pOpposite = &aTopMarginED; + + sal_Int64 nOpposite = pOpposite->GetValue(); + + if (nValue + nOpposite > Max(pEdit->GetMax(), pOpposite->GetMax())) + pOpposite->SetValue(pOpposite->GetMax() - nValue); + } + + return 0; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + + + +IMPL_LINK( SwWrapTabPage, WrapTypeHdl, ImageRadioButton *, pBtn ) +{ + sal_Bool bWrapThrough = (pBtn == &aWrapThroughRB); + aWrapTransparentCB.Enable( bWrapThrough && !bHtmlMode ); + bWrapThrough |= ( nAnchorId == FLY_AS_CHAR ); + aWrapOutlineCB.Enable( !bWrapThrough && pBtn != &aNoWrapRB); + aWrapOutsideCB.Enable( !bWrapThrough && aWrapOutlineCB.IsChecked() ); + aWrapAnchorOnlyCB.Enable( + ((nAnchorId == FLY_AT_PARA) || (nAnchorId == FLY_AT_CHAR)) && + (pBtn != &aNoWrapRB) ); + + ContourHdl(0); + return 0; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ + + + +IMPL_LINK( SwWrapTabPage, ContourHdl, CheckBox *, EMPTYARG ) +{ + sal_Bool bEnable = !(aWrapOutlineCB.IsChecked() && aWrapOutlineCB.IsEnabled()); + + aWrapOutsideCB.Enable(!bEnable); + + bEnable = !aWrapOutlineCB.IsChecked(); + if (bEnable == bContourImage) // damit es nicht immer flackert + { + bContourImage = !bEnable; + ApplyImageList(); + } + + return 0; +} + +/*-------------------------------------------------------------------- + Beschreibung: + --------------------------------------------------------------------*/ +sal_uInt16* SwWrapTabPage::GetRanges() +{ + return aWrapPageRg; +} +/* -----------------------------08.05.2002 14:28------------------------------ + + ---------------------------------------------------------------------------*/ +void SwWrapTabPage::DataChanged( const DataChangedEvent& rDCEvt ) +{ + if ( (rDCEvt.GetType() == DATACHANGED_SETTINGS) && + (rDCEvt.GetFlags() & SETTINGS_STYLE) ) + ApplyImageList(); + + SfxTabPage::DataChanged( rDCEvt ); +} +/* -----------------------------08.05.2002 14:28------------------------------ + + ---------------------------------------------------------------------------*/ +void SwWrapTabPage::ApplyImageList() +{ + ImageList& rImgLst = GetSettings().GetStyleSettings().GetHighContrastMode() ? + aWrapILH : aWrapIL; + + aWrapThroughRB.SetModeRadioImage(rImgLst.GetImage(IMG_THROUGH)); + sal_Bool bWrapOutline = !aWrapOutlineCB.IsChecked(); + if(bWrapOutline) + { + aNoWrapRB.SetModeRadioImage(rImgLst.GetImage(IMG_NONE)); + aWrapLeftRB.SetModeRadioImage(rImgLst.GetImage(IMG_LEFT)); + aWrapRightRB.SetModeRadioImage(rImgLst.GetImage(IMG_RIGHT)); + aWrapParallelRB.SetModeRadioImage(rImgLst.GetImage(IMG_PARALLEL)); + aIdealWrapRB.SetModeRadioImage(rImgLst.GetImage(IMG_IDEAL)); + } + else + { + aNoWrapRB.SetModeRadioImage(rImgLst.GetImage( IMG_KON_NONE )); + aWrapLeftRB.SetModeRadioImage(rImgLst.GetImage( IMG_KON_LEFT )); + aWrapRightRB.SetModeRadioImage(rImgLst.GetImage( IMG_KON_RIGHT )); + aWrapParallelRB.SetModeRadioImage(rImgLst.GetImage(IMG_KON_PARALLEL )); + aIdealWrapRB.SetModeRadioImage(rImgLst.GetImage( IMG_KON_IDEAL )); + } +} diff --git a/sw/source/ui/frmdlg/wrap.hrc b/sw/source/ui/frmdlg/wrap.hrc new file mode 100644 index 000000000000..be19dbe702c2 --- /dev/null +++ b/sw/source/ui/frmdlg/wrap.hrc @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#define RB_NO_WRAP 2 +#define RB_WRAP_LEFT 3 +#define RB_WRAP_RIGHT 4 +#define RB_WRAP_PARALLEL 5 +#define RB_WRAP_THROUGH 6 +#define RB_WRAP_IDEAL 7 +#define CB_ANCHOR_ONLY 8 +#define FT_LEFT_MARGIN 13 +#define ED_LEFT_MARGIN 14 +#define FT_RIGHT_MARGIN 15 +#define ED_RIGHT_MARGIN 16 +#define FT_TOP_MARGIN 17 +#define ED_TOP_MARGIN 18 +#define ED_BOTTOM_MARGIN 19 +#define FT_BOTTOM_MARGIN 20 +#define FL_MARGIN 21 +#define CB_TRANSPARENT 22 +#define CB_OUTLINE 23 +#define FL_OPTION 24 +#define CB_ONLYOUTSIDE 25 +#define FL_OPTION_SEP 26 +#define C_WRAP_FL 31 + +#define IL_WRAP 32 +#define ILH_WRAP 33 +// nur fuer die ImageList +#define IMG_BEGIN 1 +#define IMG_NONE (IMG_BEGIN) +#define IMG_LEFT (IMG_BEGIN + 1) +#define IMG_RIGHT (IMG_BEGIN + 2) +#define IMG_PARALLEL (IMG_BEGIN + 3) +#define IMG_THROUGH (IMG_BEGIN + 4) +#define IMG_IDEAL (IMG_BEGIN + 5) +#define IMG_KON_NONE (IMG_BEGIN + 6) +#define IMG_KON_LEFT (IMG_BEGIN + 7) +#define IMG_KON_RIGHT (IMG_BEGIN + 8) +#define IMG_KON_PARALLEL (IMG_BEGIN + 9) +#define IMG_KON_IDEAL (IMG_BEGIN + 10) + + diff --git a/sw/source/ui/frmdlg/wrap.src b/sw/source/ui/frmdlg/wrap.src new file mode 100644 index 000000000000..a3f23e79624b --- /dev/null +++ b/sw/source/ui/frmdlg/wrap.src @@ -0,0 +1,271 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "frmui.hrc" +#include "wrap.hrc" +#include "globals.hrc" +#include "helpid.h" +TabPage TP_FRM_WRAP +{ + SVLook = TRUE ; + HelpID = HID_FRM_EXT ; + Pos = MAP_APPFONT ( 0 , 0 ) ; + Size = MAP_APPFONT ( 260 , 185 ) ; + Hide = TRUE; + FixedLine C_WRAP_FL + { + Pos = MAP_APPFONT ( 6 , 3 ) ; + Size = MAP_APPFONT ( 248 , 8 ) ; + Text [ en-US ] = "Settings"; + }; + ImageRadioButton RB_NO_WRAP + { + HelpID = "sw:ImageRadioButton:TP_FRM_WRAP:RB_NO_WRAP"; + Pos = MAP_APPFONT ( 6 , 14 ) ; + Size = MAP_APPFONT ( 40 , 37 ) ; + WordBreak = TRUE; + Text [ en-US ] = "~None" ; + TopImage = True ; + }; + ImageRadioButton RB_WRAP_LEFT + { + HelpID = "sw:ImageRadioButton:TP_FRM_WRAP:RB_WRAP_LEFT"; + Pos = MAP_APPFONT ( 65 , 14 ) ; + Size = MAP_APPFONT ( 40 , 37 ) ; + WordBreak = TRUE; + TopImage = True ; + Text [ en-US ] = "Before" ; + }; + ImageRadioButton RB_WRAP_RIGHT + { + HelpID = "sw:ImageRadioButton:TP_FRM_WRAP:RB_WRAP_RIGHT"; + Pos = MAP_APPFONT ( 121 , 14 ) ; + Size = MAP_APPFONT ( 40 , 37 ) ; + WordBreak = TRUE; + TopImage = True ; + Text [ en-US ] = "After" ; + }; + ImageRadioButton RB_WRAP_PARALLEL + { + HelpID = "sw:ImageRadioButton:TP_FRM_WRAP:RB_WRAP_PARALLEL"; + Pos = MAP_APPFONT ( 177 , 14 ) ; + Size = MAP_APPFONT ( 40 , 37 ) ; + WordBreak = TRUE; + Text [ en-US ] = "~Parallel" ; + TopImage = True ; + }; + ImageRadioButton RB_WRAP_THROUGH + { + HelpID = "sw:ImageRadioButton:TP_FRM_WRAP:RB_WRAP_THROUGH"; + Pos = MAP_APPFONT ( 6 , 57 ) ; + Size = MAP_APPFONT ( 40 , 37 ) ; + WordBreak = TRUE; + Text [ en-US ] = "Thro~ugh" ; + TopImage = True ; + }; + ImageRadioButton RB_WRAP_IDEAL + { + HelpID = "sw:ImageRadioButton:TP_FRM_WRAP:RB_WRAP_IDEAL"; + Pos = MAP_APPFONT ( 65 , 57 ) ; + Size = MAP_APPFONT ( 40 , 37 ) ; + WordBreak = TRUE; + TopImage = True ; + Text [ en-US ] = "~Optimal" ; + }; + + CheckBox CB_ANCHOR_ONLY + { + HelpID = "sw:CheckBox:TP_FRM_WRAP:CB_ANCHOR_ONLY"; + Pos = MAP_APPFONT ( 139 , 111 ) ; + Size = MAP_APPFONT ( 109 , 10 ) ; + Text [ en-US ] = "~First paragraph" ; + }; + CheckBox CB_TRANSPARENT + { + HelpID = "sw:CheckBox:TP_FRM_WRAP:CB_TRANSPARENT"; + Pos = MAP_APPFONT ( 139 , 125 ) ; + Size = MAP_APPFONT ( 109 , 10 ) ; + Text [ en-US ] = "In bac~kground" ; + }; + CheckBox CB_OUTLINE + { + HelpID = "sw:CheckBox:TP_FRM_WRAP:CB_OUTLINE"; + Pos = MAP_APPFONT ( 139 , 139 ) ; + Size = MAP_APPFONT ( 109 , 10 ) ; + Hide = TRUE ; + Text [ en-US ] = "~Contour" ; + }; + CheckBox CB_ONLYOUTSIDE + { + HelpID = "sw:CheckBox:TP_FRM_WRAP:CB_ONLYOUTSIDE"; + Pos = MAP_APPFONT ( 139 , 153 ) ; + Size = MAP_APPFONT ( 109 , 10 ) ; + Hide = TRUE ; + Text [ en-US ] = "Outside only" ; + }; + FixedLine FL_OPTION + { + Pos = MAP_APPFONT ( 133 , 100 ) ; + Size = MAP_APPFONT ( 121 , 8 ) ; + Text [ en-US ] = "Options" ; + }; + FixedLine FL_OPTION_SEP + { + Pos = MAP_APPFONT ( 128 , 111 ) ; + Size = MAP_APPFONT ( 4 , 60 ) ; + Vert = TRUE; + }; + FixedText FT_LEFT_MARGIN + { + Pos = MAP_APPFONT ( 12 , 113 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "L~eft" ; + Left = TRUE ; + }; + MetricField ED_LEFT_MARGIN + { + HelpID = "sw:MetricField:TP_FRM_WRAP:ED_LEFT_MARGIN"; + Border = TRUE ; + Pos = MAP_APPFONT ( 81 , 111 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + Last = 9999 ; + SpinSize = 10 ; + }; + FixedText FT_RIGHT_MARGIN + { + Pos = MAP_APPFONT ( 12 , 129 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "~Right" ; + Left = TRUE ; + }; + MetricField ED_RIGHT_MARGIN + { + HelpID = "sw:MetricField:TP_FRM_WRAP:ED_RIGHT_MARGIN"; + Border = TRUE ; + Pos = MAP_APPFONT ( 81 , 127 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + Last = 9999 ; + SpinSize = 10 ; + }; + FixedText FT_TOP_MARGIN + { + Pos = MAP_APPFONT ( 12 , 145 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "~Top" ; + Left = TRUE ; + }; + MetricField ED_TOP_MARGIN + { + HelpID = "sw:MetricField:TP_FRM_WRAP:ED_TOP_MARGIN"; + Border = TRUE ; + Pos = MAP_APPFONT ( 81 , 143 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + Last = 9999 ; + SpinSize = 10 ; + }; + FixedText FT_BOTTOM_MARGIN + { + Pos = MAP_APPFONT ( 12 , 161 ) ; + Size = MAP_APPFONT ( 60 , 8 ) ; + Text [ en-US ] = "~Bottom" ; + Left = TRUE ; + }; + MetricField ED_BOTTOM_MARGIN + { + HelpID = "sw:MetricField:TP_FRM_WRAP:ED_BOTTOM_MARGIN"; + Border = TRUE ; + Pos = MAP_APPFONT ( 81 , 159 ) ; + Size = MAP_APPFONT ( 40 , 12 ) ; + TabStop = TRUE ; + Left = TRUE ; + Repeat = TRUE ; + Spin = TRUE ; + Maximum = 9999 ; + DecimalDigits = 2 ; + Unit = FUNIT_CM ; + Last = 9999 ; + SpinSize = 10 ; + }; + FixedLine FL_MARGIN + { + Pos = MAP_APPFONT ( 6 , 100 ) ; + Size = MAP_APPFONT ( 121 , 8 ) ; + Text [ en-US ] = "Spacing" ; + }; +#define WRAP_IDLIST \ + IdList = \ + { \ + IMG_NONE ; \ + IMG_LEFT ; \ + IMG_RIGHT ; \ + IMG_PARALLEL ; \ + IMG_THROUGH ; \ + IMG_IDEAL ; \ + IMG_KON_NONE ; \ + IMG_KON_LEFT ; \ + IMG_KON_RIGHT ; \ + IMG_KON_PARALLEL ;\ + IMG_KON_IDEAL ;\ + }; \ + IdCount = { 11 ; }; + + ImageList IL_WRAP + { + Prefix = "wr"; + MaskColor = IMAGE_MASK_COLOR ; + WRAP_IDLIST + }; + ImageList ILH_WRAP + { + Prefix = "wrh"; + MaskColor = IMAGE_MASK_COLOR ; + WRAP_IDLIST + }; + +}; + |