/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <com/sun/star/embed/Aspects.hpp>
#include <com/sun/star/embed/EmbedMisc.hpp>
#include <com/sun/star/embed/XEmbeddedObject.hpp>
#include <cmdid.h>
#include <hintids.hxx>
#include <bitmaps.hlst>
#include <o3tl/safeint.hxx>
#include <vcl/mnemonic.hxx>
#include <svl/stritem.hxx>
#include <sfx2/htmlmode.hxx>
#include <editeng/opaqitem.hxx>
#include <editeng/protitem.hxx>
#include <editeng/prntitem.hxx>
#include <editeng/brushitem.hxx>
#include <editeng/ulspitem.hxx>
#include <editeng/frmdiritem.hxx>
#include <svx/swframeposstrings.hxx>
#include <svx/swframevalidation.hxx>
#include <svx/sdangitm.hxx>
#include <comphelper/classids.hxx>
#include <tools/globname.hxx>
#include <tools/urlobj.hxx>
#include <fmturl.hxx>
#include <fmteiro.hxx>
#include <fmtcnct.hxx>
#include <fmtsrnd.hxx>
#include <view.hxx>
#include <wrtsh.hxx>
#include <swmodule.hxx>
#include <uitool.hxx>
#include <docsh.hxx>
#include <viewopt.hxx>
#include <frmdlg.hxx>
#include <frmmgr.hxx>
#include <frmpage.hxx>
#include <colmgr.hxx>
#include <grfatr.hxx>
#include <fmtfollowtextflow.hxx>
#include <svx/sdtaitm.hxx>
#include <sal/macros.h>
#include <osl/diagnose.h>
#include <strings.hrc>
#include <formatflysplit.hxx>
#include <fmtcntnt.hxx>
#include <svx/strings.hrc>
#include <svx/dialmgr.hxx>
#include <svx/graphichelper.hxx>
#include <sfx2/filedlghelper.hxx>
#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
#include <com/sun/star/ui/dialogs/XFilePicker3.hpp>
#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
#include <vcl/graphicfilter.hxx>
#include <svtools/embedhlp.hxx>
#include <comphelper/lok.hxx>
#include <memory>
using namespace ::com::sun::star;
using namespace ::sfx2;
#define SwFPos SvxSwFramePosString
namespace {
struct StringIdPair_Impl
{
SvxSwFramePosString::StringId eHori;
SvxSwFramePosString::StringId eVert;
};
}
#define MAX_PERCENT_WIDTH SAL_CONST_INT64(254)
#define MAX_PERCENT_HEIGHT SAL_CONST_INT64(254)
namespace {
enum class LB {
NONE = 0x00000000L,
Frame = 0x00000001L,
// text region of the paragraph
PrintArea = 0x00000002L,
// text region of the paragraph + indentions
VertFrame = 0x00000004L,
// vertical text region of the paragraph
VertPrintArea = 0x00000008L,
// vertical text region of the paragraph + indentions
RelFrameLeft = 0x00000010L,
// left paragraph edge
RelFrameRight = 0x00000020L,
// right paragraph edge
RelPageLeft = 0x00000040L,
// left page edge
RelPageRight = 0x00000080L,
// right page edge
RelPageFrame = 0x00000100L,
// whole page
RelPagePrintArea = 0x00000200L,
// text region of the page
FlyRelPageLeft = 0x00000400L,
// left frame edge
FlyRelPageRight = 0x00000800L,
// right frame edge
FlyRelPageFrame = 0x00001000L,
// whole frame
FlyRelPagePrintArea = 0x00002000L,
// inside of the frame
RelBase = 0x00010000L,
// character alignment Base
RelChar = 0x00020000L,
// character alignment Character
RelRow = 0x00040000L,
// character alignment Row
FlyVertFrame = 0x00100000L,
// vertical entire frame
FlyVertPrintArea = 0x00200000L,
// vertical frame text area
VertLine = 0x00400000L,
// vertical text line
};
}
namespace o3tl {
template <>
struct typed_flags<LB> : is_typed_flags<LB, 0x00773fffL> {};
}
namespace {
struct RelationMap
{
SvxSwFramePosString::StringId eStrId;
SvxSwFramePosString::StringId eMirrorStrId;
LB nLBRelation;
sal_Int16 nRelation;
};
}
struct FrameMap
{
SvxSwFramePosString::StringId eStrId;
SvxSwFramePosString::StringId eMirrorStrId;
sal_Int16 nAlign;
LB nLBRelations;
};
RelationMap
const aRelationMap[] =
{
{SwFPos::FRAME, SwFPos::FRAME, LB::Frame, text::RelOrientation::FRAME},
{SwFPos::PRTAREA, SwFPos::PRTAREA, LB::PrintArea, text::RelOrientation::PRINT_AREA}
,
{SwFPos::REL_PG_LEFT, SwFPos::MIR_REL_PG_LEFT, LB::RelPageLeft, text::RelOrientation::PAGE_LEFT},
{SwFPos::REL_PG_RIGHT, SwFPos::MIR_REL_PG_RIGHT, LB::RelPageRight, text::RelOrientation::PAGE_RIGHT},
{SwFPos::REL_FRM_LEFT, SwFPos::MIR_REL_FRM_LEFT, LB::RelFrameLeft, text::RelOrientation::FRAME_LEFT},
{SwFPos::REL_FRM_RIGHT, SwFPos::MIR_REL_FRM_RIGHT, LB::RelFrameRight, text::RelOrientation::FRAME_RIGHT},
{SwFPos::REL_PG_FRAME, SwFPos::REL_PG_FRAME, LB::RelPageFrame, text::RelOrientation::PAGE_FRAME},
{SwFPos::REL_PG_PRTAREA, SwFPos::REL_PG_PRTAREA, LB::RelPagePrintArea, text::RelOrientation::PAGE_PRINT_AREA},
{SwFPos::REL_CHAR, SwFPos::REL_CHAR, LB::RelChar, text::RelOrientation::CHAR },
{SwFPos::FLY_REL_PG_LEFT, SwFPos::FLY_MIR_REL_PG_LEFT, LB::FlyRelPageLeft, text::RelOrientation::PAGE_LEFT},
{SwFPos::FLY_REL_PG_RIGHT, SwFPos::FLY_MIR_REL_PG_RIGHT, LB::FlyRelPageRight, text::RelOrientation::PAGE_RIGHT},
{SwFPos::FLY_REL_PG_FRAME, SwFPos::FLY_REL_PG_FRAME, LB::FlyRelPageFrame, text::RelOrientation::PAGE_FRAME},
{SwFPos::FLY_REL_PG_PRTAREA, SwFPos::FLY_REL_PG_PRTAREA, LB::FlyRelPagePrintArea, text::RelOrientation::PAGE_PRINT_AREA},
{SwFPos::REL_BORDER, SwFPos::REL_BORDER, LB::VertFrame, text::RelOrientation::FRAME},
{SwFPos::REL_PRTAREA, SwFPos::REL_PRTAREA, LB::VertPrintArea, text::RelOrientation::PRINT_AREA},
{SwFPos::FLY_REL_PG_FRAME, SwFPos::FLY_REL_PG_FRAME, LB::FlyVertFrame, text::RelOrientation::FRAME},
{SwFPos::FLY_REL_PG_PRTAREA, SwFPos::FLY_REL_PG_PRTAREA, LB::FlyVertPrintArea, text::RelOrientation::PRINT_AREA},
{SwFPos::REL_LINE, SwFPos::REL_LINE, LB::VertLine, text::RelOrientation::TEXT_LINE}
};
RelationMap const aAsCharRelationMap[] =
{
{SwFPos::REL_BASE, SwFPos::REL_BASE, LB::RelBase, text::RelOrientation::FRAME},
{SwFPos::REL_CHAR, SwFPos::REL_CHAR, LB::RelChar, text::RelOrientation::FRAME},
{SwFPos::REL_ROW, SwFPos::REL_ROW, LB::RelRow, text::RelOrientation::FRAME}
};
// site anchored
constexpr auto HORI_PAGE_REL = LB::RelPageFrame | LB::RelPagePrintArea | LB::RelPageLeft |
LB::RelPageRight;
FrameMap const 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}
};
FrameMap const aHPageHtmlMap[] =
{
{SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, LB::RelPageFrame}
};
#define VERT_PAGE_REL (LB::RelPageFrame|LB::RelPagePrintArea)
FrameMap const 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}
};
FrameMap const aVPageHtmlMap[] =
{
{SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, LB::RelPageFrame}
};
// frame anchored
constexpr auto HORI_FRAME_REL = LB::FlyRelPageFrame | LB::FlyRelPagePrintArea |
LB::FlyRelPageLeft | LB::FlyRelPageRight;
FrameMap const 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}
};
FrameMap const aHFlyHtmlMap[] =
{
{SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, LB::FlyRelPageFrame},
{SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, LB::FlyRelPageFrame}
};
// own vertical alignment map for objects anchored to frame
#define VERT_FRAME_REL (LB::FlyVertFrame|LB::FlyVertPrintArea)
FrameMap const 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}
};
FrameMap const aVFlyHtmlMap[] =
{
{SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB::FlyVertFrame},
{SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, LB::FlyVertFrame}
};
// paragraph anchored
constexpr auto HORI_PARA_REL = LB::Frame | LB::PrintArea | LB::RelPageLeft | LB::RelPageRight |
LB::RelPageFrame | LB::RelPagePrintArea | LB::RelFrameLeft |
LB::RelFrameRight;
FrameMap const 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::PrintArea)
FrameMap const aHParaHtmlMap[] =
{
{SwFPos::LEFT, SwFPos::LEFT, text::HoriOrientation::LEFT, HTML_HORI_PARA_REL},
{SwFPos::RIGHT, SwFPos::RIGHT, text::HoriOrientation::RIGHT, HTML_HORI_PARA_REL}
};
FrameMap const 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}
};
// allow vertical alignment at page areas
constexpr auto VERT_PARA_REL = LB::VertFrame | LB::VertPrintArea |
LB::RelPageFrame | LB::RelPagePrintArea;
FrameMap const 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}
};
FrameMap const aVParaHtmlMap[] =
{
{SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB::VertPrintArea}
};
// anchored relative to the character
constexpr auto HORI_CHAR_REL = LB::Frame|LB::PrintArea | LB::RelPageLeft | LB::RelPageRight |
LB::RelPageFrame | LB::RelPagePrintArea | LB::RelFrameLeft |
LB::RelFrameRight | LB::RelChar;
FrameMap const 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::PrintArea|LB::RelChar)
FrameMap const aHCharHtmlMap[] =
{
{SwFPos::LEFT, SwFPos::LEFT, text::HoriOrientation::LEFT, HTML_HORI_CHAR_REL},
{SwFPos::RIGHT, SwFPos::RIGHT, text::HoriOrientation::RIGHT, HTML_HORI_CHAR_REL}
};
FrameMap const aHCharHtmlAbsMap[] =
{
{SwFPos::LEFT, SwFPos::MIR_LEFT, text::HoriOrientation::LEFT, LB::PrintArea|LB::RelChar},
{SwFPos::RIGHT, SwFPos::MIR_RIGHT, text::HoriOrientation::RIGHT, LB::PrintArea},
{SwFPos::FROMLEFT, SwFPos::MIR_FROMLEFT, text::HoriOrientation::NONE, LB::RelPageFrame}
};
// allow vertical alignment at page areas
constexpr auto VERT_CHAR_REL = LB::VertFrame | LB::VertPrintArea |
LB::RelPageFrame | LB::RelPagePrintArea;
FrameMap const aVCharMap[] =
{
// introduce mappings for new vertical alignment at top of line <LB::VertLine>
// and correct mapping for vertical alignment at character for position <FROM_BOTTOM>
// Note: Because of these adjustments the map becomes ambiguous in its values
// <eStrId>/<eMirrorStrId> and <nAlign>. These ambiguities are considered
// in the methods <SwFramePage::FillRelLB(..)>, <SwFramePage::GetAlignment(..)>
// and <SwFramePage::FillPosLB(..)>
{SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, VERT_CHAR_REL|LB::RelChar},
{SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, VERT_CHAR_REL|LB::RelChar},
{SwFPos::BELOW, SwFPos::BELOW, text::VertOrientation::CHAR_BOTTOM, LB::RelChar},
{SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, VERT_CHAR_REL|LB::RelChar},
{SwFPos::FROMTOP, SwFPos::FROMTOP, text::VertOrientation::NONE, VERT_CHAR_REL},
{SwFPos::FROMBOTTOM, SwFPos::FROMBOTTOM, text::VertOrientation::NONE, LB::RelChar|LB::VertLine},
{SwFPos::TOP, SwFPos::TOP, text::VertOrientation::LINE_TOP, LB::VertLine},
{SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::LINE_BOTTOM, LB::VertLine},
{SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::LINE_CENTER, LB::VertLine}
};
FrameMap const aVCharHtmlMap[] =
{
{SwFPos::BELOW, SwFPos::BELOW, text::VertOrientation::CHAR_BOTTOM, LB::RelChar}
};
FrameMap const aVCharHtmlAbsMap[] =
{
{SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB::RelChar},
{SwFPos::BELOW, SwFPos::BELOW, text::VertOrientation::CHAR_BOTTOM, LB::RelChar}
};
// anchored as character
FrameMap const aVAsCharMap[] =
{
{SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB::RelBase},
{SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::BOTTOM, LB::RelBase},
{SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, LB::RelBase},
{SwFPos::TOP, SwFPos::TOP, text::VertOrientation::CHAR_TOP, LB::RelChar},
{SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::CHAR_BOTTOM, LB::RelChar},
{SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CHAR_CENTER, LB::RelChar},
{SwFPos::TOP, SwFPos::TOP, text::VertOrientation::LINE_TOP, LB::RelRow},
{SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::LINE_BOTTOM, LB::RelRow},
{SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::LINE_CENTER, LB::RelRow},
{SwFPos::FROMBOTTOM, SwFPos::FROMBOTTOM, text::VertOrientation::NONE, LB::RelBase}
};
FrameMap const aVAsCharHtmlMap[] =
{
{SwFPos::TOP, SwFPos::TOP, text::VertOrientation::TOP, LB::RelBase},
{SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::CENTER, LB::RelBase},
{SwFPos::TOP, SwFPos::TOP, text::VertOrientation::CHAR_TOP, LB::RelChar},
{SwFPos::TOP, SwFPos::TOP, text::VertOrientation::LINE_TOP, LB::RelRow},
{SwFPos::BOTTOM, SwFPos::BOTTOM, text::VertOrientation::LINE_BOTTOM, LB::RelRow},
{SwFPos::CENTER_VERT, SwFPos::CENTER_VERT, text::VertOrientation::LINE_CENTER, LB::RelRow}
};
const WhichRangesContainer SwFramePage::s_aPageRg(svl::Items<
RES_FRM_SIZE, RES_FRM_SIZE,
RES_PROTECT, RES_PROTECT,
RES_VERT_ORIENT, RES_ANCHOR,
RES_COL, RES_COL,
RES_FOLLOW_TEXT_FLOW, RES_FOLLOW_TEXT_FLOW
>);
const WhichRangesContainer SwFrameAddPage::s_aAddPgRg(svl::Items<
RES_PRINT, RES_PRINT,
FN_SET_FRM_NAME, FN_SET_FRM_NAME,
FN_SET_FRM_ALT_NAME, FN_SET_FRM_ALT_NAME,
FN_UNO_DESCRIPTION, FN_UNO_DESCRIPTION
>);
static size_t lcl_GetFrameMapCount( const FrameMap* pMap)
{
if ( pMap )
{
if ( pMap == aVParaHtmlMap)
return std::size(aVParaHtmlMap);
if ( pMap == aVAsCharHtmlMap)
return std::size(aVAsCharHtmlMap);
if ( pMap == aHParaHtmlMap)
return std::size(aHParaHtmlMap);
if ( pMap == aHParaHtmlAbsMap)
return std::size(aHParaHtmlAbsMap);
if ( pMap == aVPageMap )
return std::size(aVPageMap);
if ( pMap == aVPageHtmlMap )
return std::size(aVPageHtmlMap);
if ( pMap == aVAsCharMap )
return std::size(aVAsCharMap);
if ( pMap == aVParaMap )
return std::size(aVParaMap);
if ( pMap == aHParaMap )
return std::size(aHParaMap);
if ( pMap == aHFrameMap )
return std::size(aHFrameMap);
if ( pMap == aVFrameMap )
return std::size(aVFrameMap);
if ( pMap == aHCharMap )
return std::size(aHCharMap);
if ( pMap == aHCharHtmlMap )
return std::size(aHCharHtmlMap);
if ( pMap == aHCharHtmlAbsMap )
return std::size(aHCharHtmlAbsMap);
if ( pMap == aVCharMap )
return std::size(aVCharMap);
if ( pMap == aVCharHtmlMap )
return std::size(aVCharHtmlMap);
if ( pMap == aVCharHtmlAbsMap )
return std::size(aVCharHtmlAbsMap);
if ( pMap == aHPageHtmlMap )
return std::size(aHPageHtmlMap);
if ( pMap == aHFlyHtmlMap )
return std::size(aHFlyHtmlMap);
if ( pMap == aVFlyHtmlMap )
return std::size(aVFlyHtmlMap);
return std::size(aHPageMap);
}
return 0;
}
static void lcl_InsertVectors(weld::ComboBox& rBox,
const std::vector< UIName >& rPrev, const std::vector< UIName >& rThis,
const std::vector< UIName >& rNext, const std::vector< UIName >& rRemain)
{
for (const auto & rItem : rPrev)
rBox.append_text(rItem.toString());
for (const auto & rItem : rThis)
rBox.append_text(rItem.toString());
for (const auto & rItem : rNext)
rBox.append_text(rItem.toString());
rBox.append_separator(u"" _ustr);
//now insert all strings sorted
const auto nStartPos = rBox.get_count();
for (const auto & rItem : rPrev)
::InsertStringSorted(u"" _ustr, rItem.toString(), rBox, nStartPos );
for (const auto & rItem : rThis)
::InsertStringSorted(u"" _ustr, rItem.toString(), rBox, nStartPos );
for (const auto & rItem : rNext)
::InsertStringSorted(u"" _ustr, rItem.toString(), rBox, nStartPos );
for (const auto & rItem : rRemain)
::InsertStringSorted(u"" _ustr, rItem.toString(), rBox, nStartPos );
}
// --> OD 2009-08-31 #mongolianlayout#
// add input parameter
static SvxSwFramePosString::StringId lcl_ChangeResIdToVerticalOrRTL(SvxSwFramePosString::StringId eStringId, bool bVertical, bool bVerticalL2R, 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 }
};
for (const StringIdPair_Impl & rHoriId : aHoriIds)
{
if (rHoriId.eHori == eStringId)
{
eStringId = rHoriId.eVert;
return eStringId;
}
}
for (size_t nIndex = 0; nIndex < SAL_N_ELEMENTS(aVertIds); ++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;
}
// helper method in order to determine all possible
// listbox relations in a relation map for a given relation
static LB lcl_GetLBRelationsForRelations( const sal_Int16 _nRel )
{
LB nLBRelations = LB::NONE;
for (RelationMap const & i : aRelationMap)
{
if ( i.nRelation == _nRel )
{
nLBRelations |= i.nLBRelation;
}
}
return nLBRelations;
}
// helper method on order to determine all possible
// listbox relations in a relation map for a given string ID
static LB lcl_GetLBRelationsForStrID( const FrameMap* _pMap,
const SvxSwFramePosString::StringId _eStrId,
const bool _bUseMirrorStr )
{
LB nLBRelations = LB::NONE;
size_t nRelMapSize = lcl_GetFrameMapCount( _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;
}
// standard frame TabPage
namespace
{
void HandleAutoCB(bool _bChecked, weld::Label& _rFT_man, weld::Label& _rFT_auto, weld::MetricSpinButton& _rPF_Edit)
{
_rFT_man.set_visible( !_bChecked );
_rFT_auto.set_visible( _bChecked );
OUString accName = _bChecked ? _rFT_auto.get_label() : _rFT_man.get_label();
_rPF_Edit.set_accessible_name(accName);
}
}
SwFramePage::SwFramePage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet &rSet)
: SfxTabPage(pPage, pController, u"modules/swriter/ui/frmtypepage.ui" _ustr, u"FrameTypePage" _ustr, &rSet)
, m_bAtHorzPosModified(false )
, m_bAtVertPosModified(false )
, m_bFormat(false )
, m_bNew(true )
, m_bNoModifyHdl(true )
, m_bIsVerticalFrame(false )
, m_bIsVerticalL2R(false )
, m_bIsInRightToLeft(false )
, m_bHtmlMode(false )
, m_nHtmlMode(0)
, m_nUpperBorder(0)
, m_nLowerBorder(0)
, m_fWidthHeightRatio(1.0)
, mpToCharContentPos(nullptr)
, m_nOldH(text::HoriOrientation::CENTER)
, m_nOldHRel(text::RelOrientation::FRAME)
, m_nOldV(text::VertOrientation::TOP)
, m_nOldVRel(text::RelOrientation::PRINT_AREA)
, m_pVMap(nullptr)
, m_pHMap(nullptr)
, m_bAllowVertPositioning( true )
, m_bIsMathOLE(false )
, m_bIsMathBaselineAlignment(true )
, m_aRatioTop(ConnectorType::Top)
, m_aRatioBottom(ConnectorType::Bottom)
, m_xWidthFT(m_xBuilder->weld_label(u"widthft" _ustr))
, m_xWidthAutoFT(m_xBuilder->weld_label(u"autowidthft" _ustr))
, m_xRelWidthCB(m_xBuilder->weld_check_button(u"relwidth" _ustr))
, m_xRelWidthRelationLB(m_xBuilder->weld_combo_box(u"relwidthrelation" _ustr))
, m_xAutoWidthCB(m_xBuilder->weld_check_button(u"autowidth" _ustr))
, m_xHeightFT(m_xBuilder->weld_label(u"heightft" _ustr))
, m_xHeightAutoFT(m_xBuilder->weld_label(u"autoheightft" _ustr))
, m_xRelHeightCB(m_xBuilder->weld_check_button(u"relheight" _ustr))
, m_xRelHeightRelationLB(m_xBuilder->weld_combo_box(u"relheightrelation" _ustr))
, m_xAutoHeightCB(m_xBuilder->weld_check_button(u"autoheight" _ustr))
, m_xFixedRatioCB(m_xBuilder->weld_check_button(u"CBX_SCALE" _ustr))
, m_xCbxScaleImg(m_xBuilder->weld_image(u"imRatio" _ustr))
, m_xImgRatioTop(new weld::CustomWeld(*m_xBuilder, u"daRatioTop" _ustr, m_aRatioTop))
, m_xImgRatioBottom(new weld::CustomWeld(*m_xBuilder, u"daRatioBottom" _ustr, m_aRatioBottom))
, m_xRealSizeBT(m_xBuilder->weld_button(u"origsize" _ustr))
, m_xProtectFrame(m_xBuilder->weld_widget(u"protect" _ustr))
, m_xProtectContentCB(m_xBuilder->weld_check_button(u"protectcontent" _ustr))
, m_xProtectFrameCB(m_xBuilder->weld_check_button(u"protectframe" _ustr))
, m_xProtectSizeCB(m_xBuilder->weld_check_button(u"protectsize" _ustr))
, m_xAnchorFrame(m_xBuilder->weld_widget(u"anchorframe" _ustr))
, m_xAnchorAtPageRB(m_xBuilder->weld_radio_button(u"topage" _ustr))
, m_xAnchorAtParaRB(m_xBuilder->weld_radio_button(u"topara" _ustr))
, m_xAnchorAtCharRB(m_xBuilder->weld_radio_button(u"tochar" _ustr))
, m_xAnchorAsCharRB(m_xBuilder->weld_radio_button(u"aschar" _ustr))
, m_xAnchorAtFrameRB(m_xBuilder->weld_radio_button(u"toframe" _ustr))
, m_xHorizontalFT(m_xBuilder->weld_label(u"horiposft" _ustr))
, m_xHorizontalDLB(m_xBuilder->weld_combo_box(u"horipos" _ustr))
, m_xAtHorzPosFT(m_xBuilder->weld_label(u"horibyft" _ustr))
, m_xAtHorzPosED(m_xBuilder->weld_metric_spin_button(u"byhori" _ustr, FieldUnit::CM))
, m_xHoriRelationFT(m_xBuilder->weld_label(u"horitoft" _ustr))
, m_xHoriRelationLB(m_xBuilder->weld_combo_box(u"horianchor" _ustr))
, m_xMirrorPagesCB(m_xBuilder->weld_check_button(u"mirror" _ustr))
, m_xVerticalFT(m_xBuilder->weld_label(u"vertposft" _ustr))
, m_xVerticalDLB(m_xBuilder->weld_combo_box(u"vertpos" _ustr))
, m_xAtVertPosFT(m_xBuilder->weld_label(u"vertbyft" _ustr))
, m_xAtVertPosED(m_xBuilder->weld_metric_spin_button(u"byvert" _ustr, FieldUnit::CM))
, m_xVertRelationFT(m_xBuilder->weld_label(u"verttoft" _ustr))
, m_xVertRelationLB(m_xBuilder->weld_combo_box(u"vertanchor" _ustr))
, m_xFollowTextFlowCB(m_xBuilder->weld_check_button(u"followtextflow" _ustr))
, m_xFlySplitCB(m_xBuilder->weld_check_button(u"flysplit" _ustr))
, m_xExampleWN(new weld::CustomWeld(*m_xBuilder, u"preview" _ustr, m_aExampleWN))
, m_xWidthED(new SwPercentField(m_xBuilder->weld_metric_spin_button(u"width" _ustr, FieldUnit::CM)))
, m_xHeightED(new SwPercentField(m_xBuilder->weld_metric_spin_button(u"height" _ustr, FieldUnit::CM)))
{
const auto nWidthRequest = m_xAtHorzPosED->get_preferred_size().Width();
m_xAtHorzPosED->set_size_request(nWidthRequest, -1);
m_xAtVertPosED->set_size_request(nWidthRequest, -1);
setOptimalFrameWidth();
setOptimalRelWidth();
SetExchangeSupport();
Link<weld::MetricSpinButton&,void > aLk3 = LINK(this , SwFramePage, ModifyHdl);
m_xWidthED->connect_value_changed( aLk3 );
m_xHeightED->connect_value_changed( aLk3 );
m_xAtHorzPosED->connect_value_changed( aLk3 );
m_xAtVertPosED->connect_value_changed( aLk3 );
m_xFollowTextFlowCB->connect_toggled(LINK(this , SwFramePage, RangeModifyClickHdl));
Link<weld::Toggleable&,void > aLk2 = LINK(this , SwFramePage, AnchorTypeHdl);
m_xAnchorAtPageRB->connect_toggled( aLk2 );
m_xAnchorAtParaRB->connect_toggled( aLk2 );
m_xAnchorAtCharRB->connect_toggled( aLk2 );
m_xAnchorAsCharRB->connect_toggled( aLk2 );
m_xAnchorAtFrameRB->connect_toggled( aLk2 );
m_xHorizontalDLB->connect_changed(LINK(this , SwFramePage, PosHdl));
m_xVerticalDLB->connect_changed(LINK(this , SwFramePage, PosHdl));
m_xHoriRelationLB->connect_changed(LINK(this , SwFramePage, RelHdl));
m_xVertRelationLB->connect_changed(LINK(this , SwFramePage, RelHdl));
m_xMirrorPagesCB->connect_toggled(LINK(this , SwFramePage, MirrorHdl));
aLk2 = LINK(this , SwFramePage, RelSizeClickHdl);
m_xRelWidthCB->connect_toggled(aLk2);
m_xRelHeightCB->connect_toggled(aLk2);
m_xAutoWidthCB->connect_toggled(LINK(this , SwFramePage, AutoWidthClickHdl));
m_xAutoHeightCB->connect_toggled(LINK(this , SwFramePage, AutoHeightClickHdl));
m_xFixedRatioCB->connect_toggled(LINK(this , SwFramePage, RatioClickHdl));
if (comphelper::LibreOfficeKit::isActive())
{
m_xAnchorAtPageRB->hide();
m_xAnchorAtFrameRB->hide();
}
}
SwFramePage::~SwFramePage()
{
}
namespace
{
struct FrameMaps
{
FrameMap const * pMap;
size_t nCount;
};
}
void SwFramePage::setOptimalFrameWidth()
{
static FrameMaps const aMaps[] = {
{ aHPageMap, std::size(aHPageMap) },
{ aHPageHtmlMap, std::size(aHPageHtmlMap) },
{ aVPageMap, std::size(aVPageMap) },
{ aVPageHtmlMap, std::size(aVPageHtmlMap) },
{ aHFrameMap, std::size(aHFrameMap) },
{ aHFlyHtmlMap, std::size(aHFlyHtmlMap) },
{ aVFrameMap, std::size(aVFrameMap) },
{ aVFlyHtmlMap, std::size(aVFlyHtmlMap) },
{ aHParaMap, std::size(aHParaMap) },
{ aHParaHtmlMap, std::size(aHParaHtmlMap) },
{ aHParaHtmlAbsMap, std::size(aHParaHtmlAbsMap) },
{ aVParaMap, std::size(aVParaMap) },
{ aVParaHtmlMap, std::size(aVParaHtmlMap) },
{ aHCharMap, std::size(aHCharMap) },
{ aHCharHtmlMap, std::size(aHCharHtmlMap) },
{ aHCharHtmlAbsMap, std::size(aHCharHtmlAbsMap) },
{ aVCharMap, std::size(aVCharMap) },
{ aVCharHtmlMap, std::size(aVCharHtmlMap) },
{ aVCharHtmlAbsMap, std::size(aVCharHtmlAbsMap) },
{ aVAsCharMap, std::size(aVAsCharMap) },
{ aVAsCharHtmlMap, std::size(aVAsCharHtmlMap) }
};
std::vector<SvxSwFramePosString::StringId> aFrames;
for (const FrameMaps & rMap : aMaps)
{
for (size_t j = 0; j < rMap.nCount; ++j)
{
aFrames.push_back(rMap.pMap[j].eStrId);
aFrames.push_back(rMap.pMap[j].eMirrorStrId);
}
}
std::sort(aFrames.begin(), aFrames.end());
aFrames.erase(std::unique(aFrames.begin(), aFrames.end()), aFrames.end());
for (const auto & rFrame : aFrames)
{
m_xHorizontalDLB->append_text(SvxSwFramePosString::GetString(rFrame));
}
Size aBiggest(m_xHorizontalDLB->get_preferred_size());
m_xHorizontalDLB->set_size_request(aBiggest.Width(), -1);
m_xVerticalDLB->set_size_request(aBiggest.Width(), -1);
m_xHorizontalDLB->clear();
}
namespace
{
struct RelationMaps
{
RelationMap const * pMap;
size_t nCount;
};
/// Checks if the current fly frame contains exactly one table.
bool ContainsSingleTable(const SwFrameFormat& rFlyFormat)
{
const SwNodeIndex* pStartNode = rFlyFormat.GetContent().GetContentIdx();
if (!pStartNode)
{
return false ;
}
// Check if the frame content starts with a table.
SwNodeIndex aNodeIndex(*pStartNode);
++aNodeIndex;
if (!aNodeIndex.GetNode().IsTableNode())
{
return false ;
}
// Check if the frame content ends with the same table.
SwNodeIndex aEndIndex(*aNodeIndex.GetNode().EndOfSectionNode());
++aEndIndex;
if (&aEndIndex.GetNode() != pStartNode->GetNode().EndOfSectionNode())
{
return false ;
}
return true ;
}
bool ContainsChain(const SwFrameFormat& rFlyFormat)
{
const SwFormatChain& rChain = rFlyFormat.GetChain();
return rChain.GetPrev() || rChain.GetNext();
}
/// Determines if rFlyFormat is anchored in a fly frame that is part of a draw-format + fly-format
/// ("textbox") pair.
bool InTextBox(const SwFrameFormat& rFlyFormat)
{
const SwFormatAnchor& rAnchor = rFlyFormat.GetAnchor();
SwNode* pAnchorNode = rAnchor.GetAnchorNode();
if (!pAnchorNode)
{
return false ;
}
const SwStartNode* pFlyNode = pAnchorNode->FindFlyStartNode();
if (!pFlyNode)
{
return false ;
}
if (!pFlyNode->GetFlyFormat()->GetOtherTextBoxFormats())
{
return false ;
}
return true ;
}
}
void SwFramePage::setOptimalRelWidth()
{
static const RelationMaps aMaps[] = {
{ aRelationMap, SAL_N_ELEMENTS(aRelationMap) },
{ aAsCharRelationMap, SAL_N_ELEMENTS(aAsCharRelationMap) }
};
std::vector<SvxSwFramePosString::StringId> aRels;
for (const RelationMaps & rMap : aMaps)
{
for (size_t j = 0; j < rMap.nCount; ++j)
{
aRels.push_back(rMap.pMap[j].eStrId);
aRels.push_back(rMap.pMap[j].eMirrorStrId);
}
}
std::sort(aRels.begin(), aRels.end());
aRels.erase(std::unique(aRels.begin(), aRels.end()), aRels.end());
for (const auto & rRel : aRels)
{
m_xHoriRelationLB->append_text(SvxSwFramePosString::GetString(rRel));
}
Size aBiggest(m_xHoriRelationLB->get_preferred_size());
m_xHoriRelationLB->set_size_request(aBiggest.Width(), -1);
m_xVertRelationLB->set_size_request(aBiggest.Width(), -1);
m_xRelWidthRelationLB->set_size_request(aBiggest.Width(), -1);
m_xRelHeightRelationLB->set_size_request(aBiggest.Width(), -1);
m_xHoriRelationLB->clear();
}
std::unique_ptr<SfxTabPage> SwFramePage::Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet *rSet)
{
return std::make_unique<SwFramePage>(pPage, pController, *rSet);
}
void SwFramePage::EnableGraficMode()
{
// i#39692 - mustn't be called more than once
if (!m_xRealSizeBT->get_visible())
{
m_xWidthFT->show();
m_xWidthAutoFT->hide();
m_xAutoHeightCB->hide();
m_xHeightFT->show();
m_xHeightAutoFT->hide();
m_xAutoWidthCB->hide();
m_xRealSizeBT->show();
}
}
SwWrtShell *SwFramePage::getFrameDlgParentShell()
{
return static_cast <SwFrameDlg*>(GetDialogController())->GetWrtShell();
}
void SwFramePage::Reset( const SfxItemSet *rSet )
{
SwWrtShell* pSh = m_bFormat ? ::GetActiveWrtShell() :
getFrameDlgParentShell();
OSL_ENSURE(pSh , "shell not found" );
if (!pSh)
return ;
m_nHtmlMode = ::GetHtmlMode(pSh->GetView().GetDocShell());
m_bHtmlMode = (m_nHtmlMode & HTMLMODE_ON) != 0;
FieldUnit aMetric = ::GetDfltMetric(m_bHtmlMode);
m_xWidthED->SetMetric(aMetric);
m_xHeightED->SetMetric(aMetric);
::SetFieldUnit(*m_xAtHorzPosED, aMetric);
::SetFieldUnit(*m_xAtVertPosED, aMetric);
const SwFormatAnchor& rAnchor = rSet->Get(RES_ANCHOR);
if (const SfxBoolItem* pMathItem = rSet->GetItemIfSet(FN_OLE_IS_MATH, false ))
m_bIsMathOLE = pMathItem->GetValue();
if (const SfxBoolItem* pAlignItem = rSet->GetItemIfSet(FN_MATH_BASELINE_ALIGNMENT, false ))
m_bIsMathBaselineAlignment = pAlignItem->GetValue();
EnableVerticalPositioning( !(m_bIsMathOLE && m_bIsMathBaselineAlignment
&& RndStdIds::FLY_AS_CHAR == rAnchor.GetAnchorId()) );
if (m_bFormat)
{
// at formats no to-fly anchor
m_xAnchorAtFrameRB->set_sensitive(false );
if (rSet->GetItemState(FN_KEEP_ASPECT_RATIO) != SfxItemState::SET)
{
m_xFixedRatioCB->set_sensitive(false );
}
}
else
{
if (rAnchor.GetAnchorId() != RndStdIds::FLY_AT_FLY && !pSh->IsFlyInFly())
m_xAnchorAtFrameRB->hide();
if ( pSh->IsFrameVertical( true , m_bIsInRightToLeft, m_bIsVerticalL2R ) )
{
OUString sHLabel = m_xHorizontalFT->get_label();
m_xHorizontalFT->set_label(m_xVerticalFT->get_label());
m_xVerticalFT->set_label(sHLabel);
m_bIsVerticalFrame = true ;
}
}
if ( m_sDlgType == "PictureDialog" || m_sDlgType == "ObjectDialog" )
{
pSh->GetGrfSize( m_aGrfSize );
if ( !m_bNew )
{
m_xRealSizeBT->connect_clicked(LINK(this , SwFramePage, RealSizeHdl));
EnableGraficMode();
}
if (m_sDlgType == "PictureDialog" )
{
m_xFixedRatioCB->set_active(false );
m_xCbxScaleImg->set_from_icon_name(RID_SVXBMP_UNLOCKED);
}
else
{
if ( m_bNew )
SetPageTitle(SwResId(STR_FRMUI_OLE_INSERT));
else
SetPageTitle(SwResId(STR_FRMUI_OLE_EDIT));
}
}
else
{
m_aGrfSize = rSet->Get(RES_FRM_SIZE).GetSize();
}
// entering percent value made possible
// 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 SwFormatFrameSize& rFrameSize = rSet->Get(RES_FRM_SIZE);
m_xRelWidthRelationLB->append_text(SvxSwFramePosString::GetString(SwFPos::FRAME));
m_xRelWidthRelationLB->append_text(SvxSwFramePosString::GetString(SwFPos::REL_PG_FRAME));
if (rFrameSize.GetWidthPercent() != SwFormatFrameSize::SYNCED && rFrameSize.GetWidthPercent() != 0)
{
//calculate the reference value from the width and relative width values
sal_Int32 nSpace = rFrameSize.GetWidth() * 100 / rFrameSize.GetWidthPercent();
m_xWidthED->SetRefValue( nSpace );
m_xRelWidthRelationLB->set_sensitive(true );
}
else
m_xRelWidthRelationLB->set_sensitive(false );
m_xRelHeightRelationLB->append_text(SvxSwFramePosString::GetString(SwFPos::FRAME));
m_xRelHeightRelationLB->append_text(SvxSwFramePosString::GetString(SwFPos::REL_PG_FRAME));
if (rFrameSize.GetHeightPercent() != SwFormatFrameSize::SYNCED && rFrameSize.GetHeightPercent() != 0)
{
//calculate the reference value from the with and relative width values
sal_Int32 nSpace = rFrameSize.GetHeight() * 100 / rFrameSize.GetHeightPercent();
m_xHeightED->SetRefValue( nSpace );
m_xRelHeightRelationLB->set_sensitive(true );
}
else
m_xRelHeightRelationLB->set_sensitive(false );
// general initialisation part
switch (rAnchor.GetAnchorId())
{
case RndStdIds::FLY_AT_PAGE: m_xAnchorAtPageRB->set_active(true ); break ;
case RndStdIds::FLY_AT_PARA: m_xAnchorAtParaRB->set_active(true ); break ;
case RndStdIds::FLY_AT_CHAR: m_xAnchorAtCharRB->set_active(true ); break ;
case RndStdIds::FLY_AS_CHAR: m_xAnchorAsCharRB->set_active(true ); break ;
case RndStdIds::FLY_AT_FLY: m_xAnchorAtFrameRB->set_active(true );break ;
default :; //prevent warning
}
// i#22341 - determine content position of character
// Note: content position can be NULL
mpToCharContentPos = rAnchor.GetAnchorNode() ? &rAnchor : nullptr;
// i#18732 - init checkbox value
{
const bool bFollowTextFlow =
rSet->Get(RES_FOLLOW_TEXT_FLOW).GetValue();
m_xFollowTextFlowCB->set_active(bFollowTextFlow);
}
{
const bool bFlySplit = rSet->Get(RES_FLY_SPLIT).GetValue();
m_xFlySplitCB->set_active(bFlySplit);
}
if (m_bHtmlMode)
{
m_xAutoHeightCB->set_sensitive(false );
m_xAutoWidthCB->set_sensitive(false );
m_xMirrorPagesCB->hide();
if (m_sDlgType == "FrameDialog" )
m_xFixedRatioCB->set_sensitive(false );
// i#18732 hide checkbox in HTML mode
m_xFollowTextFlowCB->hide();
m_xProtectFrame->hide();
}
else
{
// enable/disable of check box 'Mirror on..'
m_xMirrorPagesCB->set_sensitive(!m_xAnchorAsCharRB->get_active());
// enable/disable check box 'Follow text flow'.
// enable check box 'Follow text
// flow' also for anchor type to-frame.
m_xFollowTextFlowCB->set_sensitive(m_xAnchorAtParaRB->get_active() ||
m_xAnchorAtCharRB->get_active() ||
m_xAnchorAtFrameRB->get_active());
m_xFlySplitCB->set_sensitive(m_xAnchorAtParaRB->get_active());
}
const SwFrameFormat* pFlyFormat = pSh->GetFlyFrameFormat();
if (!pFlyFormat || !ContainsSingleTable(*pFlyFormat) || ContainsChain(*pFlyFormat))
{
bool bSingleTable = false ;
if (!pFlyFormat && m_bNew)
{
// No fly is selected: check if a whole table is selected. If so, allow moving that into
// a split fly.
if (SwFlyFrameAttrMgr::SingleTableSelected(*pSh))
{
bSingleTable = true ;
}
}
// Only allow fly split if the frame contains a single table, otherwise it would be hard to
// save the resulting model to Word formats.
if (!bSingleTable)
{
m_xFlySplitCB->hide();
}
}
else if (!m_bNew && InTextBox(*pFlyFormat))
{
// Disallow split flys in fly frames which form a textbox, i.e. non-editeng shape text.
m_xFlySplitCB->hide();
}
// Pos Protected
const SvxProtectItem& rProt = rSet->Get(RES_PROTECT);
m_xProtectFrameCB->set_active(rProt.IsPosProtected());
m_xProtectContentCB->set_active(rProt.IsContentProtected());
m_xProtectSizeCB->set_active(rProt.IsSizeProtected());
Init(*rSet);
m_xAtVertPosED->save_value();
m_xAtHorzPosED->save_value();
m_xFollowTextFlowCB->save_state();
m_xFlySplitCB->save_state();
m_xWidthED->save_value();
m_xHeightED->save_value();
m_bNoModifyHdl = false ;
//lock PercentFields
m_xWidthED->LockAutoCalculation(true );
m_xHeightED->LockAutoCalculation(true );
RangeModifyHdl(); // set all maximum values initially
m_xHeightED->LockAutoCalculation(false );
m_xWidthED->LockAutoCalculation(false );
m_xAutoHeightCB->save_state();
m_xAutoWidthCB->save_state();
SwTwips nWidth = static_cast < SwTwips >(m_xWidthED->DenormalizePercent(m_xWidthED->get_value(FieldUnit::TWIP)));
SwTwips nHeight = static_cast < SwTwips >(m_xHeightED->DenormalizePercent(m_xHeightED->get_value(FieldUnit::TWIP)));
m_fWidthHeightRatio = nHeight ? double (nWidth) / double (nHeight) : 1.0;
}
// stuff attributes into the set when OK
bool SwFramePage::FillItemSet(SfxItemSet *rSet)
{
bool bRet = false ;
const SfxPoolItem* pOldItem;
SvxProtectItem aProt(GetItemSet().Get(RES_PROTECT));
aProt.SetContentProtect(m_xProtectContentCB->get_active());
aProt.SetSizeProtect(m_xProtectSizeCB->get_active());
aProt.SetPosProtect(m_xProtectFrameCB->get_active());
if (nullptr == (pOldItem = GetOldItem(*rSet, FN_SET_PROTECT)) || aProt != *pOldItem)
bRet |= nullptr != rSet->Put(aProt);
const SfxItemSet& rOldSet = GetItemSet();
pOldItem = nullptr;
RndStdIds eAnchorId = GetAnchor();
if ( !m_bFormat || eAnchorId != RndStdIds::FLY_AT_FLY )
{
pOldItem = GetOldItem(*rSet, RES_ANCHOR);
if (m_bNew || !pOldItem || eAnchorId != static_cast <const SwFormatAnchor*>(pOldItem)->GetAnchorId())
{
SwWrtShell* pSh = m_bFormat ? ::GetActiveWrtShell()
: getFrameDlgParentShell();
OSL_ENSURE( pSh , "shell not found" );
if (pSh)
{
SwFormatAnchor aAnc( eAnchorId, eAnchorId == RndStdIds::FLY_AT_PAGE ? pSh->GetPhyPageNum() : 0 );
bRet = nullptr != rSet->Put( aAnc );
}
}
}
if ( m_pHMap )
{
SwFormatHoriOrient aHoriOrient( rOldSet.Get(RES_HORI_ORIENT) );
const sal_Int32 nMapPos = GetMapPos(m_pHMap, *m_xHorizontalDLB);
const sal_Int16 eHOri = GetAlignment(m_pHMap, nMapPos, *m_xHoriRelationLB);
const sal_Int16 eRel = GetRelation(*m_xHoriRelationLB);
aHoriOrient.SetHoriOrient( eHOri );
aHoriOrient.SetRelationOrient( eRel );
aHoriOrient.SetPosToggle(m_xMirrorPagesCB->get_active());
bool bMod = m_xAtHorzPosED->get_value_changed_from_saved();
bMod |= m_xMirrorPagesCB->get_state_changed_from_saved();
if ( eHOri == text::HoriOrientation::NONE &&
(m_bNew || (m_bAtHorzPosModified || bMod) || m_nOldH != eHOri ) )
{
SwTwips nX = static_cast < SwTwips >(m_xAtHorzPosED->denormalize(m_xAtHorzPosED->get_value(FieldUnit::TWIP)));
aHoriOrient.SetPos( nX );
}
pOldItem = GetOldItem(*rSet, FN_HORI_ORIENT);
bool bSame = false ;
if ((m_bNew == m_bFormat) && pOldItem)
{
bSame = aHoriOrient == static_cast <const SwFormatHoriOrient&>(*pOldItem);
}
if ((m_bNew && !m_bFormat) || ((m_bAtHorzPosModified || bMod) && !bSame))
{
bRet |= nullptr != rSet->Put( aHoriOrient );
}
}
if ( m_pVMap )
{
// alignment vertical
SwFormatVertOrient aVertOrient( rOldSet.Get(RES_VERT_ORIENT) );
const sal_Int32 nMapPos = GetMapPos(m_pVMap, *m_xVerticalDLB);
const sal_Int16 eVOri = GetAlignment(m_pVMap, nMapPos, *m_xVertRelationLB);
const sal_Int16 eRel = GetRelation(*m_xVertRelationLB);
aVertOrient.SetVertOrient ( eVOri);
aVertOrient.SetRelationOrient( eRel );
bool bMod = m_xAtVertPosED->get_value_changed_from_saved();
if ( eVOri == text::VertOrientation::NONE &&
( m_bNew || (m_bAtVertPosModified || bMod) || m_nOldV != eVOri) )
{
// vertical position
// recalculate offset for character bound frames
SwTwips nY = static_cast < SwTwips >(m_xAtVertPosED->denormalize(m_xAtVertPosED->get_value(FieldUnit::TWIP)));
if (eAnchorId == RndStdIds::FLY_AS_CHAR)
{
nY *= -1;
}
aVertOrient.SetPos( nY );
}
pOldItem = GetOldItem(*rSet, FN_VERT_ORIENT);
bool bSame = false ;
if ((m_bNew == m_bFormat) && pOldItem)
{
bSame = m_bFormat ?
aVertOrient.GetVertOrient() == static_cast <const SwFormatVertOrient*>(pOldItem)->GetVertOrient() &&
aVertOrient.GetRelationOrient() == static_cast <const SwFormatVertOrient*>(pOldItem)->GetRelationOrient() &&
aVertOrient.GetPos() == static_cast <const SwFormatVertOrient*>(pOldItem)->GetPos()
: aVertOrient == static_cast <const SwFormatVertOrient&>(*pOldItem);
}
if ( ( m_bNew && !m_bFormat ) || ((m_bAtVertPosModified || bMod) && !bSame ))
{
bRet |= nullptr != rSet->Put( aVertOrient );
}
}
// set size
// new exception: when the size of pMgr(, 0), then the properties
// for a graphic that isn't even loaded, are set. Then no SetSize
// is done here when the size settings were not changed by the
// user.
const SwFormatFrameSize& rOldSize = rOldSet.Get(RES_FRM_SIZE);
SwFormatFrameSize aSz( rOldSize );
auto nRelWidthRelation = m_xRelWidthRelationLB->get_active();
if (nRelWidthRelation != -1)
{
if (nRelWidthRelation == 0)
aSz.SetWidthPercentRelation(text::RelOrientation::FRAME);
else if (nRelWidthRelation == 1)
aSz.SetWidthPercentRelation(text::RelOrientation::PAGE_FRAME);
}
auto nRelHeightRelation = m_xRelHeightRelationLB->get_active();
if (nRelHeightRelation != -1)
{
if (nRelHeightRelation == 0)
aSz.SetHeightPercentRelation(text::RelOrientation::FRAME);
else if (nRelHeightRelation == 1)
aSz.SetHeightPercentRelation(text::RelOrientation::PAGE_FRAME);
}
bool bValueModified = m_xWidthED->get_value_changed_from_saved() ||
m_xHeightED->get_value_changed_from_saved();
bool bCheckChanged = m_xRelWidthCB->get_state_changed_from_saved() ||
m_xRelHeightCB->get_state_changed_from_saved() ||
m_xFixedRatioCB->get_state_changed_from_saved();
bool bLegalValue = !(!rOldSize.GetWidth () && !rOldSize.GetHeight() &&
m_xWidthED->get_value() == m_xWidthED->get_min() &&
m_xHeightED->get_value() == m_xHeightED->get_min());
if ((m_bNew && !m_bFormat) || ((bValueModified || bCheckChanged) && bLegalValue))
{
sal_Int64 nNewWidth = m_xWidthED->DenormalizePercent(m_xWidthED->GetRealValue(FieldUnit::TWIP));
sal_Int64 nNewHeight = m_xHeightED->DenormalizePercent(m_xHeightED->GetRealValue(FieldUnit::TWIP));
aSz.SetWidth (static_cast < SwTwips >(nNewWidth));
aSz.SetHeight(static_cast < SwTwips >(nNewHeight));
if (m_xRelWidthCB->get_active())
{
aSz.SetWidthPercent(static_cast <sal_uInt8>(std::min(MAX_PERCENT_WIDTH, m_xWidthED->Convert(m_xWidthED->NormalizePercent(nNewWidth), FieldUnit::TWIP, FieldUnit::PERCENT))));
}
else
aSz.SetWidthPercent(0);
if (m_xRelHeightCB->get_active())
aSz.SetHeightPercent(static_cast <sal_uInt8>(std::min(MAX_PERCENT_HEIGHT, m_xHeightED->Convert(m_xHeightED->NormalizePercent(nNewHeight), FieldUnit::TWIP, FieldUnit::PERCENT))));
else
aSz.SetHeightPercent(0);
if (m_xFixedRatioCB->get_active() && (m_xRelWidthCB->get_active() != m_xRelHeightCB->get_active()))
{
if (m_xRelWidthCB->get_active())
aSz.SetHeightPercent(SwFormatFrameSize::SYNCED);
else
aSz.SetWidthPercent(SwFormatFrameSize::SYNCED);
}
}
if ( !IsInGraficMode() )
{
if (m_xAutoHeightCB->get_state_changed_from_saved())
{
SwFrameSize eFrameSize = m_xAutoHeightCB->get_active()? SwFrameSize::Minimum : SwFrameSize::Fixed;
if ( eFrameSize != aSz.GetHeightSizeType() )
aSz.SetHeightSizeType(eFrameSize);
}
if (m_xAutoWidthCB->get_state_changed_from_saved())
{
SwFrameSize eFrameSize = m_xAutoWidthCB->get_active()? SwFrameSize::Minimum : SwFrameSize::Fixed;
if ( eFrameSize != aSz.GetWidthSizeType() )
aSz.SetWidthSizeType( eFrameSize );
}
}
if (m_xFixedRatioCB->get_state_changed_from_saved())
bRet |= nullptr != rSet->Put(SfxBoolItem(FN_KEEP_ASPECT_RATIO, m_xFixedRatioCB->get_active()));
pOldItem = GetOldItem(*rSet, RES_FRM_SIZE);
bool bSizeChanged = pOldItem && aSz != *pOldItem;
if (!bSizeChanged && m_bNew)
{
// If no custom size is provided, always set a size for a new frame, to avoid ~zero width.
bSizeChanged = true ;
}
if (bSizeChanged || (!pOldItem && !m_bFormat) ||
(m_bFormat &&
(aSz.GetWidth() > 0 || aSz.GetWidthPercent() > 0) &&
(aSz.GetHeight() > 0 || aSz.GetHeightPercent() > 0)))
{
if (aSz.GetHeightSizeType() == SwFrameSize::Variable) // there is no VAR_SIZE in frames
aSz.SetHeightSizeType(SwFrameSize::Minimum);
bRet |= nullptr != rSet->Put( aSz );
if (bRet)
{
SvxSizeItem aGSz(SID_ATTR_GRAF_FRMSIZE);
aGSz.SetSize(aSz.GetSize());
bRet |= nullptr != rSet->Put(aGSz);
}
}
if (m_xFollowTextFlowCB->get_state_changed_from_saved())
{
bRet |= nullptr != rSet->Put(SwFormatFollowTextFlow(m_xFollowTextFlowCB->get_active()));
}
if (m_xFlySplitCB->get_state_changed_from_saved())
{
bRet |= rSet->Put(SwFormatFlySplit(m_xFlySplitCB->get_active())) != nullptr;
}
return bRet;
}
// initialise horizontal and vertical Pos
void SwFramePage::InitPos(RndStdIds eId,
sal_Int16 nH,
sal_Int16 nHRel,
sal_Int16 nV,
sal_Int16 nVRel,
tools::Long nX,
tools::Long nY)
{
auto nPos = m_xVerticalDLB->get_active();
if (nPos != -1 && m_pVMap)
{
m_nOldV = m_pVMap[nPos].nAlign;
nPos = m_xVertRelationLB->get_active();
if (nPos != -1)
m_nOldVRel = weld::fromId<RelationMap*>(m_xVertRelationLB->get_id(nPos))->nRelation;
}
nPos = m_xHorizontalDLB->get_active();
if (nPos != -1 && m_pHMap)
{
m_nOldH = m_pHMap[nPos].nAlign;
nPos = m_xHoriRelationLB->get_active();
if (nPos != -1)
m_nOldHRel = weld::fromId<RelationMap*>(m_xHoriRelationLB->get_id(nPos))->nRelation;
}
bool bEnable = true ;
if ( eId == RndStdIds::FLY_AT_PAGE )
{
m_pVMap = m_bHtmlMode ? aVPageHtmlMap : aVPageMap;
m_pHMap = m_bHtmlMode ? aHPageHtmlMap : aHPageMap;
}
else if ( eId == RndStdIds::FLY_AT_FLY )
{
// own vertical alignment map for to frame
// anchored objects.
m_pVMap = m_bHtmlMode ? aVFlyHtmlMap : aVFrameMap;
m_pHMap = m_bHtmlMode ? aHFlyHtmlMap : aHFrameMap;
}
else if ( eId == RndStdIds::FLY_AT_PARA )
{
if (m_bHtmlMode)
{
m_pVMap = aVParaHtmlMap;
m_pHMap = aHParaHtmlAbsMap;
}
else
{
m_pVMap = aVParaMap;
m_pHMap = aHParaMap;
}
}
else if ( eId == RndStdIds::FLY_AT_CHAR )
{
if (m_bHtmlMode)
{
m_pVMap = aVCharHtmlAbsMap;
m_pHMap = aHCharHtmlAbsMap;
}
else
{
m_pVMap = aVCharMap;
m_pHMap = aHCharMap;
}
}
else if ( eId == RndStdIds::FLY_AS_CHAR )
{
m_pVMap = m_bHtmlMode ? aVAsCharHtmlMap : aVAsCharMap;
m_pHMap = nullptr;
bEnable = false ;
}
m_xHorizontalDLB->set_sensitive( bEnable );
m_xHorizontalFT->set_sensitive( bEnable );
// select current Pos
// horizontal
if ( nH < 0 )
{
nH = m_nOldH;
nHRel = m_nOldHRel;
}
sal_Int32 nMapPos = FillPosLB(m_pHMap, nH, nHRel, *m_xHorizontalDLB);
FillRelLB(m_pHMap, nMapPos, nH, nHRel, *m_xHoriRelationLB, *m_xHoriRelationFT);
// vertical
if ( nV < 0 )
{
nV = m_nOldV;
nVRel = m_nOldVRel;
}
nMapPos = FillPosLB(m_pVMap, nV, nVRel, *m_xVerticalDLB);
FillRelLB(m_pVMap, nMapPos, nV, nVRel, *m_xVertRelationLB, *m_xVertRelationFT);
bEnable = nH == text::HoriOrientation::NONE && eId != RndStdIds::FLY_AS_CHAR;
if (!bEnable)
m_xAtHorzPosED->set_value(0, FieldUnit::TWIP);
else
{
if (nX != LONG_MAX)
m_xAtHorzPosED->set_value(m_xAtHorzPosED->normalize(nX), FieldUnit::TWIP);
}
m_xAtHorzPosFT->set_sensitive( bEnable );
m_xAtHorzPosED->set_sensitive( bEnable );
bEnable = nV == text::VertOrientation::NONE;
if ( !bEnable )
m_xAtVertPosED->set_value(0, FieldUnit::TWIP);
else
{
if (eId == RndStdIds::FLY_AS_CHAR)
{
if ( nY == LONG_MAX )
nY = 0;
else
nY *= -1;
}
if ( nY != LONG_MAX )
m_xAtVertPosED->set_value(m_xAtVertPosED->normalize(nY), FieldUnit::TWIP);
}
m_xAtVertPosFT->set_sensitive( bEnable && m_bAllowVertPositioning );
m_xAtVertPosED->set_sensitive( bEnable && m_bAllowVertPositioning );
UpdateExample();
}
sal_Int32 SwFramePage::FillPosLB(const FrameMap* _pMap,
const sal_Int16 _nAlign,
const sal_Int16 _nRel,
weld::ComboBox& _rLB )
{
OUString sSelEntry;
const OUString sOldEntry = _rLB.get_active_text();
_rLB.clear();
// i#22341 determine all possible listbox relations for
// given relation for map <aVCharMap>
const LB nLBRelations = (_pMap != aVCharMap)
? LB::NONE
: ::lcl_GetLBRelationsForRelations( _nRel );
// fill Listbox
size_t nCount = ::lcl_GetFrameMapCount(_pMap);
for (size_t i = 0; _pMap && i < nCount; ++i)
{
// Why not from the left/from inside or from above?
SvxSwFramePosString::StringId eStrId = m_xMirrorPagesCB->get_active() ? _pMap[i].eMirrorStrId : _pMap[i].eStrId;
// --> OD 2009-08-31 #mongolianlayout#
eStrId = lcl_ChangeResIdToVerticalOrRTL( eStrId,
m_bIsVerticalFrame,
m_bIsVerticalL2R,
m_bIsInRightToLeft);
OUString sEntry(SvxSwFramePosString::GetString(eStrId));
if (_rLB.find_text(sEntry) == -1)
{
// don't insert entries when frames are character bound
_rLB.append_text(sEntry);
}
// i#22341 - add condition to handle map <aVCharMap>
// that is ambiguous in the alignment.
if ( _pMap[i].nAlign == _nAlign &&
( (_pMap != aVCharMap) || _pMap[i].nLBRelations & nLBRelations ) )
{
sSelEntry = sEntry;
}
}
_rLB.set_active_text(sSelEntry);
if (_rLB.get_active() == -1)
_rLB.set_active_text(sOldEntry);
if (_rLB.get_active() == -1 && _rLB.get_count())
_rLB.set_active(0);
PosHdl(_rLB);
return GetMapPos(_pMap, _rLB);
}
void SwFramePage::FillRelLB(const FrameMap* _pMap,
const sal_uInt16 _nLBSelPos,
const sal_Int16 _nAlign,
const sal_Int16 _nRel,
weld::ComboBox& _rLB,
weld::Label& _rFT)
{
OUString sSelEntry;
LB nLBRelations = LB::NONE;
size_t nMapCount = ::lcl_GetFrameMapCount(_pMap);
_rLB.clear();
if (_nLBSelPos < nMapCount)
{
if (_pMap == aVAsCharHtmlMap || _pMap == aVAsCharMap)
{
const OUString sOldEntry(_rLB.get_active_text());
SvxSwFramePosString::StringId eStrId = _pMap[_nLBSelPos].eStrId;
for (size_t nMapPos = 0; nMapPos < nMapCount; nMapPos++)
{
if (_pMap[nMapPos].eStrId == eStrId)
{
nLBRelations = _pMap[nMapPos].nLBRelations;
for (RelationMap const & rCharMap : aAsCharRelationMap)
{
if (nLBRelations & rCharMap.nLBRelation)
{
// --> OD 2009-08-31 #mongolianlayout#
SvxSwFramePosString::StringId sStrId1 =
lcl_ChangeResIdToVerticalOrRTL( rCharMap.eStrId,
m_bIsVerticalFrame,
m_bIsVerticalL2R,
m_bIsInRightToLeft);
const OUString sEntry = SvxSwFramePosString::GetString(sStrId1);
_rLB.append(weld::toId(&rCharMap), sEntry);
if (_pMap[nMapPos].nAlign == _nAlign)
sSelEntry = sEntry;
break ;
}
}
}
}
if (!sSelEntry.isEmpty())
_rLB.set_active_text(sSelEntry);
else
{
_rLB.set_active_text(sOldEntry);
if (_rLB.get_active() == -1)
{
for (int i = 0; i < _rLB.get_count(); i++)
{
RelationMap *pEntry = weld::fromId<RelationMap*>(_rLB.get_id(i));
if (pEntry->nLBRelation == LB::RelChar) // default
{
_rLB.set_active(i);
break ;
}
}
}
}
}
else
{
// special handling for map <aVCharMap>,
// because its ambiguous in its <eStrId>/<eMirrorStrId>.
if ( _pMap == aVCharMap )
{
nLBRelations = ::lcl_GetLBRelationsForStrID( _pMap,
( m_xMirrorPagesCB->get_active()
? _pMap[_nLBSelPos].eMirrorStrId
: _pMap[_nLBSelPos].eStrId),
m_xMirrorPagesCB->get_active() );
}
else
{
nLBRelations = _pMap[_nLBSelPos].nLBRelations;
}
for (sal_uLong nBit = 1; nBit < 0x80000000; nBit <<= 1)
{
if (nLBRelations & static_cast <LB>(nBit))
{
for (RelationMap const & rMap : aRelationMap)
{
if (rMap.nLBRelation == static_cast <LB>(nBit))
{
SvxSwFramePosString::StringId eStrId1 = m_xMirrorPagesCB->get_active() ?
rMap.eMirrorStrId : rMap.eStrId;
// --> OD 2009-08-31 #mongolianlayout#
eStrId1 =
lcl_ChangeResIdToVerticalOrRTL( eStrId1,
m_bIsVerticalFrame,
m_bIsVerticalL2R,
m_bIsInRightToLeft);
const OUString sEntry = SvxSwFramePosString::GetString(eStrId1);
_rLB.append(weld::toId(&rMap), sEntry);
if (sSelEntry.isEmpty() && rMap.nRelation == _nRel)
sSelEntry = sEntry;
}
}
}
}
if (!sSelEntry.isEmpty())
_rLB.set_active_text(sSelEntry);
--> --------------------
--> maximum size reached
--> --------------------
Messung V0.5 C=94 H=95 G=94
¤ Dauer der Verarbeitung: 0.21 Sekunden
(vorverarbeitet)
¤
*© Formatika GbR, Deutschland