/* -*- 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 .
*/
for (int i = 0; i < pKey->countValues(); ++i)
{
pValue = pKey->getValue( i ); if (pValue->m_bCustomOption) continue;
aOptionText = pParser->translateOption( pKey->getKey(), pValue->m_aOption) ;
OUString sId(weld::toId(pValue)); int nCurrentPos = rBox.find_id(sId); if( m_aJobData.m_aContext.checkConstraints( pKey, pValue ) )
{ if (nCurrentPos == -1)
rBox.append(sId, aOptionText);
} else
{ if (nCurrentPos != -1)
rBox.remove(nCurrentPos);
}
}
pValue = m_aJobData.m_aContext.getValue( pKey ); if (pValue && !pValue->m_bCustomOption)
{
OUString sId(weld::toId(pValue)); int nPos = rBox.find_id(sId); if (nPos != -1)
rBox.set_active(nPos);
}
}
if ( m_pParent->m_aJobData.meSetupMode != PrinterSetupMode::SingleJob ) return;
m_xCbFromSetup->show();
if ( m_pParent->m_aJobData.m_bPapersizeFromSetup )
m_xCbFromSetup->set_active(m_pParent->m_aJobData.m_bPapersizeFromSetup); // disable those, unless user wants to use papersize from printer prefs // as they have no influence on what's going to be printed anyway else
{
m_xPaperText->set_sensitive( false );
m_xPaperBox->set_sensitive( false );
m_xOrientText->set_sensitive( false );
m_xOrientBox->set_sensitive( false );
}
}
switch( m_pParent->m_aJobData.m_nColorDevice )
{ case 0:
m_xSpaceBox->set_active(0); break; case 1:
m_xSpaceBox->set_active(1); break; case -1:
m_xSpaceBox->set_active(2); break;
}
if (m_pParent->m_aJobData.m_nColorDepth == 8)
m_xDepthBox->set_active(0); elseif (m_pParent->m_aJobData.m_nColorDepth == 24)
m_xDepthBox->set_active(1);
// fill ppd boxes if( !m_pParent->m_aJobData.m_pParser ) return;
for( int i = 0; i < m_pParent->m_aJobData.m_pParser->getKeys(); i++ )
{ const PPDKey* pKey = m_pParent->m_aJobData.m_pParser->getKey( i );
// skip options already shown somewhere else // also skip options from the "InstallableOptions" PPD group // Options in that group define hardware features that are not // job-specific and should better be handled in the system-wide // printer configuration. Keyword is defined in PPD specification // (version 4.3), section 5.4. if( pKey->isUIKey() &&
pKey->getKey() != "PageSize" &&
pKey->getKey() != "InputSlot" &&
pKey->getKey() != "PageRegion" &&
pKey->getKey() != "Duplex" &&
pKey->getGroup() != "InstallableOptions")
{
OUString aEntry( m_pParent->m_aJobData.m_pParser->translateKey( pKey->getKey() ) );
m_xPPDKeyBox->append(weld::toId(pKey), aEntry);
}
}
}
sal_uLong RTSDevicePage::getColorDevice() const
{
sal_uInt16 nSelectPos = m_xSpaceBox->get_active(); switch (nSelectPos)
{ case 0: return 0; case 1: return 1; case 2: return -1;
} return 0;
}
IMPL_LINK(RTSDevicePage, ModifyHdl, weld::Entry&, rEdit, void)
{ if (m_pCustomValue)
{ // tdf#123734 Custom PPD option values are a CUPS extension to PPDs and the user-set value // needs to be prefixed with "Custom." in order to be processed properly
m_pCustomValue->m_aCustomOption = "Custom." + rEdit.get_text();
m_pCustomValue->m_bCustomOptionSetViaApp = true;
}
}
IMPL_LINK_NOARG(RTSDevicePage, ImplHandleReselectHdl, Timer*, void)
{ //in case selected entry is now not visible select it again to scroll it into view
m_xPPDValueBox->select(m_xPPDValueBox->get_selected_index());
}
void RTSDevicePage::ValueBoxChanged( const PPDKey* pKey )
{ const PPDValue* pValue = m_pParent->m_aJobData.m_aContext.getValue(pKey); if (pValue->m_bCustomOption)
{
m_pCustomValue = pValue;
m_pParent->m_aJobData.m_aContext.setValue(pKey, pValue); // don't show the "Custom." prefix in the UI, s.a. comment in ModifyHdl
m_xCustomEdit->set_text(m_pCustomValue->m_aCustomOption.replaceFirst("Custom.", ""));
m_xCustomEdit->show();
m_aReselectCustomIdle.Start();
} else
m_xCustomEdit->hide();
}
int SetupPrinterDriver(weld::Window* pParent, ::psp::PrinterInfo& rJobData)
{ int nRet = 0;
RTSDialog aDialog(rJobData, pParent);
// return 0 if cancel was pressed or if the data // weren't modified, 1 otherwise if (aDialog.run() != RET_CANCEL)
{
rJobData = aDialog.getSetup();
nRet = aDialog.GetDataModified() ? 1 : 0;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.