36#include <officecfg/Office/Compatibility.hxx> 
   37#include <osl/diagnose.h> 
   45    std::vector< SvtCompatibilityEntry > 
m_aList;
 
   49    : 
SfxTabPage(pPage, pController, 
"modules/swriter/ui/optcompatpage.ui", 
"OptCompatPage", &
rSet)
 
   50    , m_pWrtShell(nullptr)
 
   53    , m_bSavedMSFormsMenuOption(false)
 
   54    , m_xMain(m_xBuilder->weld_frame(
"compatframe"))
 
   55    , m_xGlobalOptionsFrame(m_xBuilder->weld_frame(
"globalcompatframe"))
 
   56    , m_xFormattingLB(m_xBuilder->weld_combo_box(
"format"))
 
   57    , m_xGlobalOptionsLB(m_xBuilder->weld_combo_box(
"globaloptions"))
 
   58    , m_xOptionsLB(m_xBuilder->weld_tree_view(
"options"))
 
   59    , m_xGlobalOptionsCLB(m_xBuilder->weld_tree_view(
"globaloptioncheckbox"))
 
   60    , m_xDefaultPB(m_xBuilder->weld_button(
"default"))
 
   84    const bool bReadOnly = officecfg::Office::Compatibility::View::MSCompatibleFormsMenu::isReadOnly();
 
  112    bool _bAddSpacingAtPages,
 
  113    bool _bUseOurTabStops,
 
  115    bool _bUseLineSpacing,
 
  116    bool _bAddTableSpacing,
 
  117    bool _bAddTableLineSpacing,
 
  119    bool _bUseOurTextWrapping,
 
  120    bool _bConsiderWrappingStyle,
 
  121    bool _bExpandWordSpace,
 
  123    bool _bMsWordCompTrailingBlanks,
 
  124    bool bSubtractFlysAnchoredAtFlys,
 
  125    bool bEmptyDbFieldHidesPara,
 
  126    bool bUseVariableWidthNBSP
 
  130    sal_uInt32 nSetBit = 1;
 
  134    nSetBit = nSetBit << 1;
 
  135    if ( _bAddSpacingAtPages )
 
  137    nSetBit = nSetBit << 1;
 
  138    if ( _bUseOurTabStops )
 
  140    nSetBit = nSetBit << 1;
 
  141    if ( _bNoExtLeading )
 
  143    nSetBit = nSetBit << 1;
 
  144    if ( _bUseLineSpacing )
 
  146    nSetBit = nSetBit << 1;
 
  147    if ( _bAddTableSpacing )
 
  149    nSetBit = nSetBit << 1;
 
  150    if (_bAddTableLineSpacing)
 
  152    nSetBit = nSetBit << 1;
 
  155    nSetBit = nSetBit << 1;
 
  156    if ( _bUseOurTextWrapping )
 
  158    nSetBit = nSetBit << 1;
 
  159    if ( _bConsiderWrappingStyle )
 
  161    nSetBit = nSetBit << 1;
 
  162    if ( _bExpandWordSpace )
 
  164    nSetBit = nSetBit << 1;
 
  167    nSetBit = nSetBit << 1;
 
  168    if ( _bMsWordCompTrailingBlanks )
 
  170    nSetBit = nSetBit << 1;
 
  171    if (bSubtractFlysAnchoredAtFlys)
 
  173    nSetBit = nSetBit << 1;
 
  174    if (bEmptyDbFieldHidesPara)
 
  176    nSetBit = nSetBit << 1;
 
  177    if (bUseVariableWidthNBSP)
 
  201    const OUString& rText = 
m_xMain->get_label();
 
  202    m_xMain->set_label(rText.replaceAll(
"%DOCNAME", sDocTitle));
 
  213        m_pImpl->m_aList.push_back( rEntry );
 
  215        if ( bIsDefaultEntry )
 
  222        else if ( pObjShell && !sEntryName.isEmpty() )
 
  227                sNewEntry = pFilter->GetUIName();
 
  230        if ( sNewEntry.isEmpty() )
 
  231            sNewEntry = sEntryName;
 
  256    sal_uInt32 nOptions = m_xFormattingLB->get_active_id().toUInt32();
 
  257    SetCurrentOptions(nOptions);
 
  263    std::unique_ptr<weld::MessageDialog> xQueryBox(xBuilder->weld_message_dialog(
"QueryDefaultCompatDialog"));
 
  264    if (xQueryBox->run() != 
RET_YES)
 
  267    auto pItem = std::find_if(
m_pImpl->m_aList.begin(), 
m_pImpl->m_aList.end(),
 
  270            const OUString sEntryName = rItem.getValue<OUString>( SvtCompatibilityEntry::Index::Name );
 
  271            const bool bIsDefaultEntry = ( sEntryName == SvtCompatibilityEntry::DEFAULT_ENTRY_NAME );
 
  272            return bIsDefaultEntry;
 
  274    if (pItem != 
m_pImpl->m_aList.end())
 
  276        const sal_Int32 
nCount = m_xOptionsLB->n_children();
 
  279            bool bChecked = m_xOptionsLB->get_toggle(
i);
 
  281            int nCoptIdx = 
i + 2; 
 
  285                bool const isLineSpacing = m_xOptionsLB->get_toggle(
i) == 
TRISTATE_TRUE;
 
  301    OSL_ENSURE( 
nCount <= 32, 
"SwCompatibilityOptPage::Reset(): entry overflow" );
 
  304        bool bChecked = ( ( nOptions & 0x00000001 ) == 0x00000001 );
 
  308            nOptions = nOptions >> 1;
 
  310                && (nOptions & 0x00000001) != 0x00000001) 
 
  316        nOptions = nOptions >> 1;
 
  350    for ( 
const auto& rItem : 
m_pImpl->m_aList )
 
  356    return std::make_unique<SwCompatibilityOptPage>(pPage, pController, *rAttrSet);
 
  361    bool bModified = 
false;
 
  366        OSL_ENSURE( 
nCount <= 32, 
"SwCompatibilityOptPage::Reset(): entry overflow" );
 
  374                nSavedOptions = nSavedOptions >> 1;
 
  376                    && ((nSavedOptions & 0x00000001) != 0x00000001))
 
  381            if (current != saved)
 
  385                int nCoptIdx = 
i + 2; 
 
  455            nSavedOptions = nSavedOptions >> 1;
 
  466        officecfg::Office::Compatibility::View::MSCompatibleFormsMenu::set(bNewMSFormsMenuOption, batch);
 
@ CONSIDER_WRAP_ON_OBJECT_POSITION
@ DO_NOT_JUSTIFY_LINES_WITH_MANUAL_BREAK
@ USE_FORMER_TEXT_WRAPPING
@ PARA_SPACE_MAX_AT_PAGES
@ ADD_PARA_SPACING_TO_TABLE_CELLS
@ USE_VARIABLE_WIDTH_NBSP
@ EMPTY_DB_FIELD_HIDES_PARA
@ MS_WORD_COMP_TRAILING_BLANKS
@ ADD_PARA_LINE_SPACING_TO_TABLE_CELLS
static std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIFile, bool bMobile=false, sal_uInt64 nLOKWindowId=0)
Provides access to settings of a document.
virtual bool get(DocumentSettingId id) const =0
Return the specified document setting.
virtual void set(DocumentSettingId id, bool value)=0
Set the specified document setting.
std::shared_ptr< const SfxFilter > GetFilter4FilterName(const OUString &rName, SfxFilterFlags nMust=SfxFilterFlags::NONE, SfxFilterFlags nDont=SFX_FILTER_NOTINSTALLED) const
const T * GetItemIfSet(TypedWhichId< T > nWhich, bool bSrchInParent=true) const
SfxFilterContainer * GetFilterContainer() const
virtual SfxObjectFactory & GetFactory() const=0
OUString GetTitle(sal_uInt16 nMaxLen=0) const
SfxOkDialogController * GetDialogController() const
weld::Window * GetFrameWeld() const
@ SubtractFlysAnchoredAtFlys
static constexpr OUStringLiteral DEFAULT_ENTRY_NAME
static constexpr OUStringLiteral USER_ENTRY_NAME
std::vector< SvtCompatibilityEntry > GetList() const
void AppendItem(const SvtCompatibilityEntry &aItem)
std::unique_ptr< weld::ComboBox > m_xGlobalOptionsLB
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rAttrSet)
std::unique_ptr< weld::TreeView > m_xGlobalOptionsCLB
std::unique_ptr< weld::Frame > m_xGlobalOptionsFrame
SvtCompatibilityOptions m_aConfigItem
void SetCurrentOptions(sal_uInt32 nOptions)
sal_uInt32 m_nSavedOptions
sal_uInt32 GetDocumentOptions() const
bool m_bSavedMSFormsMenuOption
std::unique_ptr< weld::Frame > m_xMain
SwCompatibilityOptPage(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rSet)
void InitControls(const SfxItemSet &rSet)
std::unique_ptr< weld::TreeView > m_xOptionsLB
std::unique_ptr< weld::Button > m_xDefaultPB
std::unique_ptr< weld::ComboBox > m_xFormattingLB
virtual ~SwCompatibilityOptPage() override
virtual bool FillItemSet(SfxItemSet *rSet) override
virtual void Reset(const SfxItemSet *rSet) override
std::unique_ptr< SwCompatibilityOptPage_Impl > m_pImpl
IDocumentSettingAccess const & getIDocumentSettingAccess() const
void SetProtectForm(bool _bProtectForm)
void SetParaSpaceMax(bool bNew)
void SetUseFormerTextWrapping(bool _bUseFormerTextWrapping)
const IDocumentSettingAccess & getIDocumentSettingAccess() const
Provides access to the document setting interface.
void SetDoNotJustifyLinesWithManualBreak(bool _bDoNotJustifyLinesWithManualBreak)
void SetUseFormerLineSpacing(bool _bUseFormerLineSpacing)
Sets if former formatting of text lines with proportional line spacing should used.
void SetUseFormerObjectPositioning(bool _bUseFormerObjPos)
Sets IDocumentSettingAccess if former object positioning should be used.
void SetParaSpaceMaxAtPages(bool bNew)
void SetAddExtLeading(bool bNew)
void SetConsiderWrapOnObjPos(bool _bConsiderWrapOnObjPos)
void SetTabCompat(bool bNew)
void SetMsWordCompTrailingBlanks(bool _bMsWordCompTrailingBlanks)
void SetSubtractFlysAnchoredAtFlys(bool bSubtractFlysAnchoredAtFlys)
void SetAddParaSpacingToTableCells(bool _bAddParaSpacingToTableCells)
Sets if paragraph and table spacing is added at bottom of table cells.
void SetEmptyDbFieldHidesPara(bool bEmptyDbFieldHidesPara)
SwDocShell * GetDocShell()
Used by the UI to modify the document model.
const SwView & GetView() const
static std::shared_ptr< ConfigurationChanges > create()
#define FN_PARAM_WRTSHELL
weld::Window * GetFrameWeld(const SfxFrame *pFrame)
#define LINK(Instance, Class, Member)
Reference< XComponentContext > getProcessComponentContext()
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
static sal_uInt32 convertBools2Ulong_Impl(bool _bAddSpacing, bool _bAddSpacingAtPages, bool _bUseOurTabStops, bool _bNoExtLeading, bool _bUseLineSpacing, bool _bAddTableSpacing, bool _bAddTableLineSpacing, bool _bUseObjPos, bool _bUseOurTextWrapping, bool _bConsiderWrappingStyle, bool _bExpandWordSpace, bool _bProtectForm, bool _bMsWordCompTrailingBlanks, bool bSubtractFlysAnchoredAtFlys, bool bEmptyDbFieldHidesPara, bool bUseVariableWidthNBSP)
IMPL_LINK_NOARG(SwCompatibilityOptPage, SelectHdl, weld::ComboBox &, void)
std::vector< SvtCompatibilityEntry > m_aList